TopGit
GitHub Repo Review

nvm: Node.js Version Manager for Shells

nvm-sh/nvm
NTopGit review image for nvm-sh/nvm
Review by Topgit.dev for nvm-sh/nvm, with GitHub repository stats and README context.
Quick verdict

Node Version Manager (nvm) is a shell script that installs and switches between multiple Node.js versions per shell, not a system-wide package. Reach for it if you work in bash, zsh, or another POSIX shell on Linux, macOS, or WSL2 and want project-by-project version control without sudo; skip it if you're on native Windows without WSL or you use Fish shell, since the README says neither is supported.

Stars
★ 94.5k
Forks
⑂ 10.4k
Language
Shell
License
MIT
Topic
Updated
Jul 2026
Homepage
GitHub

What is Node Version Manager (nvm)?

Node Version Manager (nvm) is a POSIX-compliant shell script — not a compiled binary — that you source into bash, zsh, ksh, dash, or another POSIX shell to install and switch between Node.js versions. It runs per-user and per-shell: cloning itself into ~/.nvm (or your $XDG_CONFIG_HOME), then loading as a shell function, so commands like nvm use only change the active node in that one shell session.

Key Capabilities of nvm

  • Version switching in one line: `nvm install 24`, `nvm use 22`, and `nvm use 20` each swap the node on $PATH for that shell session, per the README's own example.
  • Built-in aliases beyond raw version numbers — node (latest), iojs (latest io.js), stable/unstable (legacy pre-1.0 aliases), and current (whatever's active right now, unaffected by .nvmrc).
  • LTS-line targeting with lts/* for the newest LTS or lts/argon for a specific codename release line, usable across install, uninstall, use, exec, run, and ls-remote.
  • Package migration flag --reinstall-packages-from=<version> reinstalls your global npm packages onto a freshly installed Node version without silently bumping npm itself.
  • nvm exec and nvm which let you run one command against a specific Node version in a subshell, or just print the path to that version's binary, without switching your whole shell.
  • Install script accepts NVM_SOURCE, NVM_DIR, PROFILE, and NODE_VERSION overrides, plus a --no-use flag to install without activating a version immediately.
How this repository's GitHub stars have grown over time. Source: star-history.com.View the star history

Installing and Updating nvm

To install or update nvm, the README points to running its install script via a one-line curl or wget command. That script clones the nvm repository into ~/.nvm (or $XDG_CONFIG_HOME/nvm if that variable is set) and tries to append the right source lines to your profile file — ~/.bashrc, ~/.bash_profile, ~/.zshrc, or ~/.profile — falling back to whichever the $PROFILE env var points at if it picks the wrong one. You can override the install source, directory, profile, and version via NVM_SOURCE, NVM_DIR, PROFILE, and NODE_VERSION, add --no-use to skip auto-activating a version, or set PROFILE=/dev/null to stop it from touching your shell config at all. A manual git install works too, but the README sets a minimum required git version of v1.7.10 for cloning and tag checkout. Verify the install with `command -v nvm`, not `which nvm`, since nvm is a sourced shell function rather than an executable binary. The README also documents a Docker pattern that sources nvm via the BASH_ENV variable for non-interactive containers.

Managing Node.js Versions with nvm

Install a specific version with `nvm install <version>`, or use the node alias for the latest release — the first version you install becomes the default for new shells. `nvm use <version>` switches the active version in your current shell, `nvm run node --version` runs node directly, and `nvm exec <version> <command>` runs any command in a subshell against a chosen version without switching your shell's default. `nvm which <version>` prints the path to that version's installed binary. `nvm alias <name> <version>` sets a custom alias (no spaces or slashes allowed), and `nvm ls-remote` lists versions available to install. LTS flags (--lts, --lts=argon, 'lts/*', lts/argon) work across install, uninstall, use, exec, run, and ls-remote. To move to the latest LTS while carrying over your currently installed packages, the README gives `nvm install --reinstall-packages-from=current 'lts/*'`.

Strengths

  • Works across POSIX shells — bash, zsh, ksh, dash — and macOS, Linux, and Windows WSL2, per the README's own platform list.
  • Built-in aliases (node, current, lts/*, lts/argon) mean scripts and .nvmrc files can reference a version without a project author guessing today's exact release number.
  • --reinstall-packages-from migrates your global npm packages to a new Node version in one command, deliberately without touching npm's own version.
  • No sudo needed for global npm installs once nvm owns your Node — packages land under ~/.nvm/$NVM_DIR instead of a system path.
  • Install script is scriptable: NVM_SOURCE, NVM_DIR, PROFILE, NODE_VERSION env vars, plus --no-use and PROFILE=/dev/null for automated or CI setups.
  • MIT licensed, with a documented Docker + BASH_ENV pattern for non-interactive CI/CD builds.

Important Considerations and Unsupported Environments

  • Homebrew installs aren't supported — the README says to `brew uninstall` it and reinstall via the install script if you hit issues.
  • Fish shell isn't supported natively; the README lists third-party wrappers like nvm.fish and fish-nvm instead.
  • Windows isn't a native target — nvm works through WSL2, Git Bash (MSYS), or Cygwin, not a plain PowerShell or cmd.exe session.
  • Git-based installs need git v1.7.10 or newer; the README notes older git versions have trouble cloning over https and can't clone tags.
  • Building Node from source (when no prebuilt binary exists for your platform) requires a C++ compiler — Xcode command line tools on macOS, or build-essential and libssl-dev on Debian/Ubuntu.
  • The LTS alias files nvm generates under $NVM_DIR/alias/lts are managed automatically; the README warns not to hand-edit them since nvm may overwrite them and won't support bugs caused by doing so.

Alternatives for Specific Platforms and Shells

nvm-windows — a separate version manager that runs natively on Windows; unlike nvm, it needs no WSL, Git Bash, or Cygwin (per nvm's own README, which lists it as an alternative it doesn't support).nvs — a cross-platform Node version switcher the nvm README points Windows users toward, though nvm itself doesn't maintain it.nodist — another Windows-focused Node version manager the README lists alongside nvm-windows and nvs for users nvm doesn't support natively.nvm.fish — a Fish-shell-native rewrite, since nvm explicitly doesn't support Fish, per its own README, which links to it as an alternative.fish-nvm — a wrapper around nvm for Fish that delays sourcing nvm until it's actually used, per nvm's own README.

Frequently Asked Questions about nvm

Does nvm work on Windows?

Node Version Manager (nvm) doesn't target Windows natively — the README says it works through WSL2, Git Bash (MSYS), or Cygwin. For a native Windows tool, the README points to nvm-windows, nodist, or nvs instead.

Can nvm be used with Fish shell?

Node Version Manager (nvm) doesn't support Fish, per its own README. The README lists alternatives built for Fish instead, including nvm.fish, fish-nvm, and bass.

Is nvm compatible with Homebrew installations?

Homebrew installation of nvm isn't supported. The README asks anyone hitting issues with a Homebrew-installed nvm to `brew uninstall` it and reinstall using the official install script.

How do I install Node.js LTS versions using nvm?

Run `nvm install --lts` for the newest LTS release, or target a specific line with `nvm install --lts=argon` or `nvm install lts/argon`, per the README.

Do I need sudo to install global npm packages with nvm?

Node Version Manager (nvm) removes the need for sudo on global npm installs, since packages under nvm live in your home directory rather than a system path — just make sure your ~/.npmrc doesn't set a prefix, which the README says is incompatible with nvm.

What are the Git version requirements for nvm?

Node Version Manager (nvm) requires git v1.7.10 or newer for git-based installs and updates; the README notes older versions have trouble cloning over https and can't clone tags.

The problem it solves

Different projects on the same machine often need different Node.js majors — one still pinned to an LTS line, another testing the latest release — but a single system-wide Node install (via apt, a Windows installer, or Homebrew) only gives you one version at a time, and switching it usually means sudo and manual reinstalls. nvm addresses this by installing Node under your home directory per-user and loading a specific version into each shell session, so `node -v` can report something different in two terminal tabs without touching the OS package manager.

Best use cases

  • Keeping several Node majors installed side by side on one dev machine and switching per terminal tab with nvm use <version>, per the README's own example.
  • Non-interactive Docker builds that need a pinned Node version — the README documents sourcing nvm via BASH_ENV since profile files aren't read in non-interactive shells.
  • Bumping a project to a new Node release while carrying over globally installed npm packages via --reinstall-packages-from.
  • Referring to LTS lines generically (lts/*, lts/argon) in scripts or .nvmrc files instead of hardcoding a version number that goes stale.

Who should try it — and who should skip

Reach for nvm if you're a developer on macOS, Linux, or WSL2 working across projects that pin different Node majors, and you want to switch versions per terminal without a system-wide reinstall or sudo. Skip it if you're on native Windows without WSL — use nvm-windows, nodist, or nvs instead — or if you use Fish shell, where the README points you to nvm.fish or fish-nvm; also skip a Homebrew-installed copy, since the README says that path isn't supported.

Related repositories

Source & attribution

Facts and quotes sourced from the nvm-sh/nvm GitHub repository and its README.

GitHub data · last synced Aug 12, 2026Reviewed by Henry
Back to TopGit

Still deciding about nvm?

One click hands the question to an AI along with this page — see what it says about nvm.

GitHub