CloudLinux.ro
Dev environments

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 pricing

Related tutorials