Home Linux Ubuntu How to Install and Manage Node.js Version Using NVM

How to Install and Manage Node.js Version Using NVM

Q.I need multiple Node version for multiple projects.
Sol: In such cases NVM used.
Q.How to install and manage node using nvm??

What is NVM?

NVM stands for Node Version Manager. As the name suggests, NVM used to manage the multiple Node version. Sometimes you got multiple projects with different node versions. Then this would be more helpful.

In such cases, with NVM you can switch easily between the node versions. In this article will let you know step by step how to install and manage node version using nvm.

Step 1: Install Node.js on Ubuntu

The first step is to install the NVM on your system. Run the following command and it will install the NVM.

curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash

After executing the above command, do not forget to close the terminal. Again open the terminal and you can also check its installed version using the below command.

nvm --version
Check nvm version
Check nvm version

Step 2: Install Latest Node Version using nvm

To check the available node version to install, run the following command.

nvm ls-remote

Now, run the following command to install the available latest node version on the ubuntu system.

nvm install v12.6.0
install node v12 using nvm
install node v12 using nvm

To check the installed Node version on the system, execute the following command.

nvm ls

Step 3: Change Node Version Using NVM

NVM has the ability to switch easily between the multiple node version. First, check the list of installed node.js version on the ubuntu system. After that set the default node.js version as per project needs.

nvm ls
List of installed Node.js version
List of installed Node.js version

As you can check the current default node version is v10.16.0. You can easily change the node version. FOr example, we want to change the node version to v12.6.0. Just run the below command.

nvm use v12.6.0
Set default node.js version
Set default node.js version

Now the node.js version is switched to the desired version. For more details, you can also visit theĀ Node Version Manager Github repository.

Read More: How to Install Angular 8 on Ubuntu 16.04 & 18.04

Conclusion: You have perfectly learned how to switch to multiple node.js version using NVM command. For any feedback, kindly write in below command box.

LEAVE A REPLY

Please enter your comment!
Please enter your name here