Summary: in this tutorial, you will learn how to install and use Node Version Manager (NVM) on Windows.
Managing multiple Node.js versions on a computer when having a different Node.js project and each requires a different version can be challenging.
Fortunately, Node Version Manager (NVM) can help you easily manage and switch multiple versions of Node.js on your computer.
NVM supports only macOS and Linux. However, on Windows, you can use nvm-windows.
Install NVM for Windows
First, download nvm-windows (nvm-setup.exe) from the nv-windows release page.
Second, run the installer and follow the installation process.
When you install NVM, it’ll scan for the installed Node.js and prompt you whether you want it to manage this Node.js version. Please click yes to allow NVM to manage it.
Install Node.js via nvm
First, open a new Command Prompt or PowerShell window.
Second, run the nvm install command to install a specific Node.js version:
npm install <version>
Code language: HTML, XML (xml)
Replace the version with the version number you want to install, for example:
nvm install 20.6.0
Code language: CSS (css)
To install the latest Long-term support (LTS) version, you can use the following command:
nvm install lts
If you want to install the latest Node.js, you can use the following command:
nvm instal latest
List installed Node.js versions
First, open a new Command Prompt or PowerShell window.
Second, run the nvm list command to list out all the installed Node.js versions:
nvm list
Code language: PHP (php)
The output looks like the following:
* 22.6.0 (Currently using 64-bit executable)
20.16.0
18.12.1
Code language: CSS (css)
The version with an asterisk (*) indicates the currently active Node.js version. You can verify it by checking the Node.js version:
node -v
Output:
v22.6.0
Code language: CSS (css)
Alternatively, you can run the nvm current command:
nvm current
It’ll return the currently active Node.js version:
v22.6.0
Code language: CSS (css)
Switch Node.js version
To switch to a specific Node.js, you use the following command:
nvm use <version>
Code language: HTML, XML (xml)
Replace <version> with a version number you want to switch to. For example:
nvm use 20.16.0
Code language: CSS (css)
Some User Account Control popups may be displayed. Just click Yes, and you’ll see the following output:
Now using node v20.16.0 (64-bit)
Code language: CSS (css)
And you can verify the currently active Node.js version:
nvm current
Output:
v20.16.0
Code language: CSS (css)
Uninstall a Node.js version
To uninstall a specific Node.js version on your computer:
First, list out all the installed versions using the nvm list
command:
nvm list
Code language: PHP (php)
Second, run the uninstall command:
nvm uninstall <version>
Code language: HTML, XML (xml)
Replace the <version>
with the one you want to uninstall.
Summary
- Use Node Version Manager (NVM) to manage and switch between multiple Node.js versions on a single computer.
- Use
nvm install
command to install a specific Node.js version. - Use
nvm list
command to display a list of installed Node.js versions on your computer. - Use
nvm use
command to switch to a specific Node.js version. - Use
nvm current
command to show the currently active Node.js version. - Use
nvm uninstall
command to uninstall a specific Node.js version on your computer.