Switch between multiple versions of Node.js in Windows
Last updated: October 27, 2023.
Using Node Version Manager (NVM), it is possible to install multiple versions of Node.js simultaneously and easily switch between them.
First, you need to install NVM on your system. On Windows, you can do this by downloading and running the nvm-windows installer.
Once you have NVM installed, you can run nvm ls
from the command line to list your installed versions of Node.js:
nvm ls
* 19.4.0 (Currently using 64-bit executable)
To install another version, run nvm install
, followed by the version number:
nvm install 16.20.2
Downloading node.js version 16.20.2 (64-bit)...
Extracting node and npm...
Complete
npm v8.19.4 installed successfully.
Now, running nvm ls
again will display a new version of Node.js in the list:
nvm ls
* 19.4.0 (Currently using 64-bit executable)
16.20.2
The *
symbol indicates the current version of Node.js. To switch to the newly installed version, you call nvm use
, followed by the version number:
nvm use 16.20.2
Now using node v16.20.2 (64-bit)
Now, nvm ls
will show that you are using the new version:
nvm ls
19.4.0
* 16.20.2 (Currently using 64-bit executable)
Now, calling node -v
will show that your default version of Node.js is now the new version:
node -v
v16.20.2
If you want to uninstall a Node version, call nvm uninstall
followed by the version number:
nvm uninstall v16.20.2
Uninstalling node v16.20.2... done
The version will now no longer display after calling nvm ls
and will no longer be your default version of Node:
nvm ls
19.4.0
Because no Node version is selected, it is necessary to run nvm use
again to switch back to the previously installed version:
nvm use 19.4.0
Now using node v19.4.0 (64-bit)
nvm ls
* 19.4.0 (Currently using 64-bit executable)
The original version of Node is now the default version:
node -v
v19.4.0