Skip to content

nvm

nvm, short for Node Version Manager, is a command-line tool that installs several versions of Node.js on one machine and switches between them for each shell session. A project that needs an older Node.js release can run next to one that tracks the latest.

nvm is a set of shell functions that works in POSIX-compliant shells such as Bash and Zsh on macOS, Linux, and Windows Subsystem for Linux (WSL). It doesn’t run in the native Windows command prompt or PowerShell. nvm-windows is a separate project with its own commands, and fnm and Volta are other Node.js version managers.

Installation and Setup

nvm is installed once per user. The official install script clones nvm into ~/.nvm and adds the lines that load it to the shell’s profile file:

Language: Shell
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.41.0/install.sh | bash

After opening a new terminal, confirm the installed version:

Language: Shell
$ nvm --version
0.41.0

Because nvm is a shell function and not an executable file, which nvm doesn’t find it. Use command -v nvm to check that the shell has loaded it.

Key Features

  • Downloads prebuilt Node.js binaries and checks their SHA-256 checksums before installing them.
  • Keeps every Node.js version, along with its global npm packages, in its own folder under ~/.nvm.
  • Switches versions per shell session, so two terminals can run different versions at the same time.
  • Reads a project’s Node.js version from an .nvmrc file in the project folder or any parent folder.
  • Accepts aliases such as node for the latest release and lts/* for the latest long-term support release.

Usage

Say a team’s API project runs on Node.js 26, while an older side project still needs Node.js 24. The install command downloads a version and switches the current shell to it:

Language: Shell
$ nvm install 26
Downloading and installing node v26.13.0...
Checksums matched!
Now using node v26.13.0 (npm v11.20.0)
Creating default alias: default -> 26 (-> v26.13.0 *)

After installing Node.js 24 the same way, the use command switches back and forth:

Language: Shell
$ nvm use 24
Now using node v24.22.2 (npm v11.19.1)

To pin the API project to Node.js 26, write the version to an .nvmrc file in its root folder. Running nvm use with no version then reads the file:

Language: Shell
$ echo "26" > .nvmrc
$ nvm use
Found '/home/ada/api/.nvmrc' with version <26>
Now using node v26.13.0 (npm v11.20.0)

The ls command lists the installed versions and marks the active one with an arrow:

Language: Shell
$ nvm ls
       v24.22.2 *
->     v26.13.0 *
default -> 26 (-> v26.13.0 *)

New shells start with the version that the default alias points to. To change it, pass a new version to nvm alias:

Language: Shell
$ nvm alias default 24
default -> 24 (-> v24.22.2 *)

For every command and option, see the nvm documentation.

Have a question about this? Mentor AI can show you examples, compare related terms, and point you to tutorials.


By Leodanis Pozo Ramos • Updated Nov. 6, 2026