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

How is Livepatch safeguarded against bad actors?

Canonical Livepatch is a security patching automation tool which supports reboot-less security updates for the…

3 hours ago

Accelerating data science with Apache Spark and GPUs

Apache Spark has always been very well known for distributing computation among multiple nodes using…

3 hours ago

Cut data center energy costs with bare metal automation

Data centers are popping up everywhere. With the rapid growth of AI, cloud services, streaming…

1 day ago

Build the future of *craft: announcing Starcraft Bounties!

Our commitment to building a thriving open source community is stronger than ever. We believe…

1 day ago

NodeJS 18 LTS EOL extended from April 2025 to May 2032 on Ubuntu

The clock was ticking: Node.js 18’s upstream End of Life (EOL) The OpenJS Foundation is…

1 day ago

Native integration now available for Pure Storage and Canonical LXD

June 25th, 2025 – Canonical, the company behind Ubuntu, and Pure Storage, the IT pioneer…

2 days ago