Categories: Ubuntu

How to Downgrade the Node Version on Ubuntu?

NodeJS is a well-reputed open-source JavaScript environment that can be run on wide platforms like macOS, Linux, Windows, and much more. Its main objective is to execute the JavaScript code outside the browser. It also helps to build scalable and fast server-side dynamic network applications based on the JavaScript programming languages.

In some situations, the user needs to use the specific node version for building and modifying the node.js application as per requirements. For this purpose, the user upgrades or downgrades the node version according to the application’s needs and specifications.

This guide will provide a complete procedure to downgrade the node version on Ubuntu.

How
Sponsored
to Downgrade Node Version on Ubuntu?

To downgrade the node version on Ubuntu, use the “n” command. This command installs, activates, and removes the node version immediately. Moreover, it can also manage the different node versions in the Linux operating systems easily.

This section carries out the practical implementation of “n” command to downgrade the node version on Ubuntu using the given steps of instructions.

Step 1: Check Node Version
Firstly, check out the already installed node version by specifying its name like “node” with the “version(v)” flag:

node v

The installed node version is “v18.17.1”:

Step 2: Install “n” in Ubuntu
Next, execute the following installation command with the administrative privileges to install the “n” command globally in the Ubuntu system:

sudo npm install -g n

In the above command, the “npm” keyword refers to the “node package manager ” and the “sudo” denotes the administrator.

The following output confirms that the “n” package has been added to the current OS:

Sponsored

Step 3: Install Downgrade Node Version
Now, use the “n” command to install any older/downgrade node version in the Ubuntu operating system:

sudo n 10.16.0

Here, the output shows that the specified node version has been installed successfully in Ubuntu. Now, the current Ubuntu OS maintains both older and newly installed node versions placed at the specified path:

In the above output, the purpose and use of the highlight “hash -r” command are discussed in the next step.

Step 4: Verify Downgraded Node.js Version
Before the verification of a newly installed node, it is recommended to start a new shell or reset the location of the node using the “hash” command along with the “-r” flag. It forgets all the remembered location from the hash table because the current shell will not show the newly installed node version until it clears the existing node location:

hash r
node v //Checking Node version

After clearing the hash table of the current Ubuntu system, the version command shows the newly installed downgraded version of the node:

Hence it is verified that the node “v18.17.1” version has been downgraded to “v10.16.0”.

That’s all about downgrading the Node version on Ubuntu.

Conclusion

To downgrade the node version on Ubuntu, use the “n” command. It is not the built-in command so the user first needs to install it into the Ubuntu OS through the “npm” package manager and then utilize it for downgrading the node version. It switches the node version in the form of upgradation or downgradation. This guide has described the complete procedure to downgrade the node version on Ubuntu.

Ubuntu Server Admin

Recent Posts

Canonical Releases Ubuntu 25.04 Plucky Puffin

The latest interim release of Ubuntu introduces “devpacks” for popular frameworks like Spring, along with…

3 days ago

Ubuntu 25.04 (Plucky Puffin) Released

Ubuntu 25.04, codenamed “Plucky Puffin”, is here. This release continues Ubuntu’s proud tradition of integrating…

3 days ago

Extended Security Maintenance for Ubuntu 20.04 (Focal Fossa) begins May 29, 2025

Ubuntu released its 20.04 (Focal Fossa) release 5 years ago, on March 23, 2020. As…

4 days ago

Ubuntu 20.04 LTS End Of Life – activate ESM to keep your fleet of devices secure and operational

Focal Fossa will reach the End of Standard Support in May 2025, also known as…

5 days ago

Ubuntu MATE 25.04 Release Notes

Ubuntu MATE 25.04 is ready to soar! 🪽 Celebrating our 10th anniversary as an official…

5 days ago

Ubuntu Weekly Newsletter Issue 887

Welcome to the Ubuntu Weekly Newsletter, Issue 887 for the week of April 6 –…

6 days ago