If you're a developer who works with various Node.js versions on a regular basis, you've probably had to switch between them without any problems. You may manage several Node.js versions on your machine with the help of the wonderful Node Version Manager (NVM) utility. Even though it was first created for Unix-based platforms, Node.js version management is made simple on Windows by a Windows-compatible version.
You can follow the instructions in this page to install and use NVM for Windows.
Why Use NVM?
When you use NVM, you can:
- Change between Node.js versions with ease.
- Separately install, manage, and update Node.js versions.
- To make sure the work together, test your apps using several Node.js versions.
Insalling NVM for Windows
Windows needs a specific version of NVM called NVM for Windows, created by Corey Butler, in contrast to Unix systems, where NVM is installed via the command line. This utility makes managing Node.js versions on Windows simple and emulates the Unix version's behaviour.
How to set it up is as follows
1. Download NVM for Windows
- Go to the NVM for Windows GitHub release page.
- Download the lastest nvm-setup.exe file
2. Install NVM for Windows
1. Run the installer.
2. during installation, select the directory for NVM and Node.js installations.
3. Verify installation
Open a new command prompt and type:
nvm -v
4. Installing a Specific Version of Node.js using NVM
To install a specific version of Node.js Enter following command on command prompt
nvm install <version>
For example , I have install node.js 20.15.0
nvm install 20.15.0
5. Listing Installed Versions
List all installed node version, Enter following command on command prompt
nvm list
6. Swtch between Versions
To switch to a specific Node.js version, use:
nvm use <version>
For example
nvm use 20.15.0
After switching, NVM will set this version as the active version on your system. You can confirm the active version by running:
node -v
Comman Issues and Troubleshooting
- Node.js Not Recognized: If you get warning "Node.js not recognized," try shutting down and restating PowerShell or you command prompt. The environment variables might need to be reloaded by NVM.
- Permission Problems: If you get permission issues, make sure you launch your command prompt as an administrator.
Login to leave a comment.