How to use nvm to install multiple nodeJS versions on windows?

Spread the love

Hello Friends,

If you are professional developer and using frameworks/libraries which uses NodeJS, you may come to a situation like you want to install multiple Node js on your development environment and use one at a time when need, This situation may also happens when you are working on a multiple versions of same product you are building and one uses old node version and for the brand new you want to use the latest node version.

To handle the above situation, you can use Node Version Manager (nvm) which helps you to install/use multiple node versions on same machine. Lets understand how to install and use nvm for our work.

Install NVM (Node Version Manager) for Windows

To Install nvm on windows you can use nvm-windows package from github and this is recommended by Microsoft too. here is the link

https://github.com/coreybutler/nvm-windows

Open the above link and click on “Download Now”

nvm

This will redirect you to the releases page , Go to “Assets” section and download the nvm-setup.exe as below

This will download the nvm-setup exe to you local download folder.

Run the exe to start the nvm-windows installation, you should get the similar window as below.

Complete the installation by following the installation wizard. If you already have any nodeJS version installed on machine it will prompt you as below.

Click on Yes to manage the NodeJS using nvm and Click on finish once installation is done.

Using NVM (Node Version Manager) for Windows

Now open command prompt/windows terminal and type “nvm” , you should be getting the output similar to below. Your nvm version might change if there any latest version you have installed.

lets type “nvm list” which will give the list of installed nodeJS versions on machine. You might be getting the output similar to below.

Now lets assume you want to install latest node version on machine. type “nvm install latest” as below. here is the output from my machine.

You can see it downloaded and installed the node 19.0.0 too on my machine. Now, I have two different versions of nodeJS which can be checked using nvm list command.

Lets we also want to install any older node version too , example nodeJS 12.0.0, we can install any nodeJS version by running nvm install [version number] command as below.

Lets check all NodeJS installed on machine.

Now, lets we want to use nodeJS 12.0.0 for some reason. we can switch to that version using nvm use 12.0.0 command as below(make sure you are running the terminal/command prompt as admin).

You can see the current active NodeJS version is now 12.0.0, similarly you can switch to different installed versions/install multiple NodeJS versions and use it one at a time for your purpose.

You can install latest LTS version using nvm install lts

nvm

So in the above blog post we have learned and answered the questions on :-

—Can you install multiple node versions?
—Can we install 2 versions of node on Windows?
—How do I use multiple node versions in Windows without NVM?

Thanks and Happy Learning :). Please give your valuable feedback and share this post.

Leave a Reply

Your email address will not be published. Required fields are marked *

Proudly powered by WordPress | Theme: Lean Blog by Crimson Themes.