Node.js projects often depend on different runtime majors because frameworks, build tools, and deployment targets move on separate schedules. nvm keeps those versions under one user account so a developer can test or run a project without replacing the system Node.js package.
nvm is loaded as a shell function, so it changes the current shell's PATH when a version is selected. The install script adds loader lines to the user's shell profile, and the same loader can be sourced manually when the current terminal session needs nvm immediately.
Development shells on Linux, macOS, or Windows WSL can keep project-specific versions isolated without affecting system services. The default alias controls new shells, while a project .nvmrc file lets nvm use select the runtime expected by that project directory.
Related: Install the latest Node.js on Ubuntu
Related: Create a Node.js project with npm
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.5/install.sh | bash => Downloading nvm from git to '/home/developer/.nvm' => Cloning into '/home/developer/.nvm'... ##### snipped ##### => Appending nvm source string to /home/developer/.bashrc => Appending bash_completion source string to /home/developer/.bashrc => Close and reopen your terminal to start using nvm or run the following to use it now:
Read remote install scripts before running them on managed workstations. The nvm installer clones into the current user's home directory and edits that user's shell profile.
$ . "$HOME/.nvm/nvm.sh"
Closing and reopening the terminal loads the profile changes instead.
$ nvm --version 0.40.5
$ nvm install --lts Installing latest LTS version. Downloading and installing node v24.18.0... ##### snipped ##### Checksums matched! Now using node v24.18.0 (npm v11.16.0) Creating default alias: default -> lts/* (-> v24.18.0 *)
The exact patch version follows the current Node.js LTS release.
$ node --version v24.18.0
$ nvm alias default lts/* default -> lts/* (-> v24.18.0 *)
$ nvm install 22 Downloading and installing node v22.23.1... ##### snipped ##### Checksums matched! Now using node v22.23.1 (npm v10.9.8)
Replace 22 with the major, minor, or full version required by the project.
$ nvm use --lts Now using node v24.18.0 (npm v11.16.0)
22
$ nvm use Found '/srv/app/.nvmrc' with version <22> Now using node v22.23.1 (npm v10.9.8)
Run nvm use from the project root so nvm can find the nearest .nvmrc file.
$ node --version v22.23.1