What I Wanted to Do

Switch Node.js versions per project without reinstalling Node.js each time.

Windows (nvm-windows)

Download nvm-setup.exe from https://github.com/coreybutler/nvm-windows/releases

nvm install 22
nvm use 22

Mac

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
nvm install 22
nvm use 22

Common Commands

nvm install 22          # Install Node.js 22
nvm use 22              # Switch to version 22
nvm ls                  # List installed versions
nvm alias default 22    # Set default version

Common Pitfalls

  • On Windows, use nvm-windows — the original nvm is Unix-only
  • Uninstall any existing Node.js before installing nvm-windows
  • Without nvm alias default, the version resets every time you open a new terminal

If npm still doesn’t work after switching versions on Windows, see npm Command Not Working on Windows.

  • Fiverr - Find freelance developers and tech experts