How to Switch Node.js Versions on Windows using NVM (Step-by-Step Guide)

Managing different Node.js versions on Windows can be tricky, especially when each project demands its own version. NVM for Windows solves this problem by enabling easy version switching. This guide explains clearly how to install and use NVM, highlighting common installation issues and troubleshooting steps.
Key Takeaways
- Use nvm-windows to switch Node.js versions quickly.
- Remove previous Node installations to avoid conflicts.
- Run commands in an administrator terminal to prevent common permission issues.
Installing NVM for Windows
Step 1: Remove Existing Node Installations
Before installing NVM, uninstall any existing Node.js to avoid conflicts:
- Go to Settings > Apps and uninstall Node.js.
- Ensure no
nodejs
folder remains inC:Program Filesnodejs
.
Installing nvm-windows
-
Download the latest nvm-windows release.
-
Run
nvm-setup.exe
and follow prompts (use default locations). -
Open a new terminal as Administrator and verify installation:
nvm --version
Installing Latest Node.js Versions
With NVM installed, you can now easily manage multiple Node.js versions:
- To install the latest LTS (currently Node.js 22.x):
nvm install lts
- For a specific version (e.g., Node.js 23.x):
nvm install 23.3.0
List installed Node versions:
nvm ls
How to Switch Node.js Versions
Once versions are installed, switching is simple:
- To activate a specific version:
nvm use 22.14.0
- Confirm the active version:
node -v
npm -v
Troubleshooting Common NVM Issues
Issue: NVM doesn’t switch Node versions
Cause: A previous Node installation exists.
Solution:
- Delete or rename the existing
C:Program Filesnodejs
folder. - Run
nvm use <version>
again.
Issue: Permission errors (access denied)
Cause: Symlink creation needs elevated privileges.
Solution:
- Run Command Prompt as Administrator, or
- Enable Windows Developer Mode (Settings > Update & Security > For developers).
Issue: ‘nvm’ command not found
Cause: Path environment not updated.
Solution: Close and reopen your terminal or restart Windows.
Issue: Global npm packages missing after switching
Cause: Global packages are version-specific.
Solution: Reinstall global packages per Node.js version or use local installs (npx
).
Best Practices
- Document the Node version per project.
- Regularly update nvm-windows and remove unused Node versions.
- Use Node LTS versions for stability.
Conclusion
Using nvm-windows streamlines managing multiple Node.js versions on Windows. Proper setup and troubleshooting help avoid common pitfalls, smoothing your development process.
FAQs
No, the original NVM is for Linux and macOS. Windows users should use nvm-windows.
Usually, this is caused by leftover Node installations. Remove or rename any existing Node installation folders.
Yes, unless you enable Developer Mode on Windows.
[TOGGLE question=""How do I uninstall a Node version from NVM?"" answer=""Use the command nvm uninstall <version>
."" ]
Typically in `%AppData%Roamingnvm`. Each version is installed separately.