How to install Node.js with nvm (multiple versions)
Updated 7/20/2026
Different projects may require different Node.js versions. nvm (Node Version Manager) lets you install them and switch between them easily.
1. Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
source ~/.bashrc
2. Install a Node version
nvm install 20 # latest version 20
nvm install 18
3. Switch between versions
nvm use 18
nvm alias default 20 # the default version
4. Check
node -v
npm -v
Per project version
Put a .nvmrc file in the project with the desired version, then run nvm use in the directory to select it automatically.
In production
To run a Node app reliably, use PM2 or a systemd service, see how to deploy a Node.js app and how to create a systemd service.
Put this guide into practice on your own VPS
EU cloud servers, billed hourly, ready in minutes, with one-click installs for dozens of apps.
See pricingRelated tutorials
How to create a systemd service for your app
Make your app start automatically and restart itself if it stops, with a systemd service.
Updated 7/20/2026Dev environmentsHow to keep sessions running after disconnect with tmux
tmux keeps your terminal sessions alive even after you close SSH, ideal for long-running tasks.
Updated 7/20/2026Dev environmentsHow to install PHP (multiple versions) and Composer
Install the PHP version your project needs, along with Composer for package management.
Updated 7/20/2026