nvm installs and switches between Node.js versions from the command line on POSIX shells including bash and zsh.
Overview
nvm is a Node Version Manager implemented as a POSIX-compliant shell script. It is meant to be installed per user and loaded in each shell session so you can download, compile, or install different Node.js releases and select which one is active.
It runs on common POSIX shells such as sh, dash, ksh, zsh, and bash, on Unix systems, macOS, and Windows via WSL. Git Bash and Cygwin are mentioned with caveats; native Windows has separate alternatives noted in the docs.
Typical usage includes installing the latest or a specific Node version, setting default aliases, listing remote versions, and running commands under a chosen version with nvm exec or nvm run. The .nvmrc file can pin a version per directory, with optional shell integration to call nvm use automatically.
Installation is done via a curl or wget script that clones into ~/.nvm and updates the shell profile. Docker examples show non-interactive use with BASH_ENV for containers and CI jobs.
Key features
- Per-shell Node.js version switching
- Install specific or latest Node releases
- Default alias for new shells
- Remote version listing and filters
- nvmrc directory version pins
- Optional bash and zsh auto-use hooks
- POSIX shell compatibility
- Docker and CI usage patterns
Use cases
- Matching Node per project
- Testing against multiple Node versions
- CI images with pinned Node
- Developer laptops on macOS or Linux
- WSL development on Windows