Manage multiple Node.js versions using NVM

Recently in one of my project, I couldn’t run the npm install command successfully. After debugging for a while I came to know that I needed previous version of Node.js to install all the dependency successfully.

NVM

So I googled and came across the NVM tool which handles such situation. It allow us to install multiple version of the Node.js and maintains them. We can choose whichever version of the Node.js we want and go back to the default once we’re done with it.

Install NVM

To read the installation steps for different OS please go to the NVM page on Github. There is also a Github page to install NVM on windows machines.

Using NVM

To install the latest version of the Node.js:

nvm install node

This will install the latest version of the Node.js.

To install the specific version of the Node.js, for example, if you want to install 0.11.14 version of the Node.js, do this:

nvm install 0.11.14

After installation finished, you need to point NVM to use 0.11.14 version of Node.js like below:

nvm use 0.11.14

To see all the installed version:

nvm list

This will list all the installed version like below image:

List of Node.js versions
List of Node.js versions

When you’re done with specific version and do not need it any more, you can uninstall it:

nvm uninstall 0.11.14

 

Hope this helps!
NVM can be life saviour when you work on multiple projects parallel.

Web/ UI & Front-end developer based in Ahmedabad, GJ, India. Here to help/ discuss community to spread web awareness.

Leave a reply:

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.