NVM: managing Node.js versions
A quick guide to installing, listing and switching Node versions with NVM, headache-free.
What is NVM?
NVM (Node Version Manager) lets you install and switch between several Node.js versions on the same machine. It’s essential when you work on projects that use different Node versions.
To install or update NVM, follow the instructions in the official guide.
Essential commands
List the versions available to install
nvm ls-remote
# LTS only:
nvm ls-remote --lts
Install a version
nvm install 20 # installs the latest 20.x
nvm install --lts # installs the latest LTS
nvm install 18.19.0 # exact version
List installed versions
nvm ls
Use a specific version (current session)
nvm use 20
nvm use --lts
Check which version is active
nvm current
node --version
Set the default version (persists across sessions)
nvm alias default 20
Uninstall a version
nvm uninstall 18
See where NVM is installed
nvm root
Typical flow
# 1. Install the latest LTS
nvm install --lts
# 2. Make it the default
nvm alias default --lts
# 3. Check
node --version
npm --version
💡 Tip: one .nvmrc per project
Create a .nvmrc file at the project root with the version you want:
20
Then just run nvm use in the project folder and NVM reads the file automatically.