Manage multiple NodeJs versions using NVM

Dipendra Neupane
codenp
Published in
3 min readDec 6, 2022
Photo by Sigmund on Unsplash

Sometimes it's annoying because of version unmatched dependencies while working on different projects on your device with varying versions of nodejs.

For example, maybe you have the latest version of Nodejs installed and your latest projects are running fine yet you also have a few old projects built on previous NodeJs versions and you also have to work on them quite often.

In such a situation either you can upgrade the old project to the latest version or you can uninstall the latest NodeJs version and reinstall the previous NodeJs version.

It's time-consuming in the first place and not an appropriate way most of the time because of different reasons.

Introducing NVM

NVM (Node Version Manager) is an open-source version manager tool for NodeJs.

As the name suggests, it eases the developers to switch and manage different versions of NodeJs as needed.

With its command line interface, you can install an available version of NodeJs, switch among them when needed, and much more.

NVM supports all major OS — MacOs, Linux, and Windows. Here I’m writing based on the Windows platform.

Installation and Use of NVM on Windows

Download the latest version .exe file of NVM from Github. In my case it was nvm-setup.exe.

After installation nvm command is available from anywhere in your terminal.

Here are a few useful commands one can utilize.

nvm list

This command will list all the installed versions of Node where the selected version is flagged with *.

nvm list available

This command will list all the versions of Node available for installation.

nvm install <version>

This command will install the mentioned version of Node on your machine.

nvm use <version>

This command comes in handy when you need to switch your projects having different node versions.

These are some hand-picked commands mostly useful for daily work.

The nvm, command lists out all the available other commands as well.

--

--

Dipendra Neupane
codenp
Editor for

Full-Stack Software Dev | When Dipendra isn't busy crafting code or captivating content, you can find him enjoying a good cup of americano or hitting the Gym.