Find your next open-source project

Search by name, purpose, or keyword — or paste a GitHub repository URL

nvm-sh/nvm

Developer Tools

Install and switch between multiple Node.js versions per shell with a POSIX-compliant shell script.

95,537
10,528
Shell
MIT
16 years old

What it does

nvm is a per-user, per-shell Node.js version manager written as a POSIX-compliant shell script. It lets you install, list, alias, and switch between Node.js releases (including LTS lines and io.js) from the command line, so different projects can run on different Node versions without a system-wide install. It works in sh, dash, ksh, zsh, and bash, mainly on Unix, macOS, and WSL/Git Bash/Cygwin environments (About).

Typical use is straightforward:

nvm install 24
nvm use 22
nvm use 20

The README shows the expected result: after nvm install 24, node -v reports v24.x, and after nvm use 22, it reports v22.x (Intro).

Install and first run

On Linux or macOS, the install script clones nvm into ~/.nvm and adds the source lines to your shell profile:

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

A Wget alternative is also documented (install script). Then verify the install:

command -v nvm

It should print nvm; which nvm will not work because nvm is a sourced shell function, not a binary (verify installation). On macOS, install the Xcode command line tools first. On Linux, if the command is not found, open a new terminal or source the relevant profile file. If you need a nonstandard location or profile, set NVM_DIR or PROFILE before running the script.

For manual or Git-based installation, the README gives repository-cloning commands and the profile snippet to source nvm.sh and bash_completion (Git install).

Working with versions

Useful commands from the documentation include:

  • nvm install node for the latest Node.js release, or nvm install 14.7.0 for a specific version.
  • nvm ls for installed versions and nvm ls-remote for versions available to install.
  • nvm alias default 18 to choose the version used by new shells.
  • nvm install --lts and lts/* aliases to select LTS releases.
  • nvm use system to fall back to the system-installed Node.js.
  • nvm install --reinstall-packages-from=node node to migrate global npm packages to a new version.
  • nvm install --offline 14.7.0 to install from the local cache without network access.

Project-level version pinning is supported through a .nvmrc file in the project root or a parent directory; nvm use, nvm install, and nvm which read it when no version is passed on the command line (.nvmrc).

Constraints and compatibility

nvm is per-user and per-shell, and its install script modifies a shell profile, so permissions and profile paths matter. On Linux and macOS the install script requires Git; on macOS, the Xcode command line tools must be installed first. Windows is not directly supported in the usual sense, though it may work via WSL, Git Bash/MSYS, or Cygwin; alternatives such as nvm-windows, nodist, and nvs are mentioned as separate projects (Important Notes).

Where nodejs.org has no binary for your platform and architecture, nvm install falls back to compiling from source, which requires a C++ toolchain and is slow; setting NVM_NO_SOURCE_FALLBACK=1 makes a missing binary an error instead. Alpine Linux uses musl, and nvm requests a musl build for x64 and arm64; older Alpine versions may need extra packages and may only support Node versions up to a certain point (Alpine Linux).

Known conflicts include an npm prefix setting in ~/.npmrc, the NPM_CONFIG_PREFIX and PREFIX environment variables, and set -e in the shell (Compatibility Issues). nvm is MIT-licensed and maintained as part of the OpenJS Foundation ecosystem; the README states that only the latest version is supported (Project Support).

HotRepo's take

nvm is a long-running developer utility: GitHub metadata shows the repository created in 2010, and snapshots from August to October 2026 record total stars rising from about 94.4k to 95.5k with daily gains mostly in the tens and a one-day gain of 151 on 2026-09-06. That pattern is consistent with steady maintenance interest rather than a new-project spike; no all-language daily rank was recorded for this repository in the available data, so the star counts alone do not establish current popularity. The single linked Hacker News thread is a 2021 post about an Ubuntu PPA package with one comment, and the commenter argues that installation scripts are less convenient than distro package managers, which is a debate about distribution method rather than a functional defect observed in the project.

Written by AI from the project's README, updated . The project's own docs are the source of truth.

Hacker News

NVM – Package for Ubuntu PPA and Backport
▲ 1 · 1 comment · July 3, 2021