DEV Community

Sonu kumar
Sonu kumar

Posted on

How to install NVM(Node Version Manager) on Windows

NVM is a Node Version Manager used to manage multiple Node.js versions on systems.

Why NVM Need?

NVM makes it easy to install and manage different Node versions on your machine or laptop, and you can switch between them whenever you need it from one node version to another based on your need. To switch to another version of node.js, you have to run a few commands, which I will explain in the below sections.

Suppose you have installed the specific version of node 18.0.0 on your machine, and you will get another project that project needs a higher or lower version of node.js (either node version 20.0.0 or 16.0.0 )to run the project on your machine but your system has node 18.0.0. So when you try to install packages and run the project you will get the Node version.

In the following sections, I’ll guide you through installing NVM on your Windows, Linux, or Mac device.

Before proceeding, I recommend uninstalling Node.js if you installed it to avoid conflicts between Node.js and NVM.

Node version error

Installing NVM on Windows

NVM is primarily supported on Linux and Mac, but not on Windows. However, there’s a similar tool called nvm-windows created by Corey Butler, which provides a similar experience for managing Node.js versions on Windows.

Below are the steps on how to install nvm-windows:

1. Download nvm-windows:

Go to the nvm-windows repository README file and click on the Download Now button, Or you can click here to Download. This will take you to a page with various NVM releases.

nvm-windows download

Download the NVM for Windows

  1. Install the .exe file: Once you are redirected to the release page (currently version 1.1.12) click on nvm-setup.exe and it downloads the nvm-windows on your machine.

nvm-windows release page

  1. Run the installer:
    Open the downloaded file and follow the prompts to complete the installation wizard.

  2. Verify the installation:
    After installation, open a command prompt and run:

nvm -v
Enter fullscreen mode Exit fullscreen mode

If everything is installed correctly, this command will display the installed NVM version.

NVM Commands for switching between Node versions:

To view available Node versions, run the following command:

nvm list
Enter fullscreen mode Exit fullscreen mode

Now you can see what the list of node versions available in the machine looks like,

NVM list command to see the list of node versions

If you want to select a specific version of the node.js that version is in the above list (screenshot image). Then run the below commands to select the particular node version and press enter.

Here I am selecting node version 14.17.1

nvm use v14.17.1
Enter fullscreen mode Exit fullscreen mode

Verified selected node version:

node -v
Enter fullscreen mode Exit fullscreen mode

then you will see the selected node version instead of the default one, here I have selected node 14 so it will show nod 14 for me.

What happens if the specified version of the node is not available then we have to install it using nvm command and then select it from the above steps.

To install a specific node version:

nvm install 20.0.0
Enter fullscreen mode Exit fullscreen mode

Thank you for reading our article, I have tried to cover the all-important command and steps for more details visit the nvm-windows

Please like follow and share, I need your support!!
Thank you!!

Follow Me on:
Linkedin
Medium
X(formally known as Twitter)

Top comments (0)