nvm-sh /nvm
Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions.
★ 95,785⑂ 10,719👁 1,108⑃ 1,283● 2,475▤ 76◈ 0
95,785
stars
+13+47+517
10,719
forks
1,108
watchers
1,283
prs
2,475
issues
76
releases
0
discussions
README
Node Version Manager ![Tests][3] ![nvm version][4]
Table of Contents
- Intro
- About
- Installing and Updating
- Install & Update Script
- Additional Notes
- Installing in Docker
- Installing in Docker for CICD-Jobs
- Troubleshooting on Linux
- Troubleshooting on macOS
- Ansible
- Verify Installation
- Important Notes
- Git Install
- Manual Install
- Manual Upgrade
- Usage
- Long-term Support
- Version Categories
- Migrating Global Packages While Installing
- Migrating Global Packages Between Installed Versions
- Offline Install
- Default Global Packages From File While Installing
- io.js
- System Version of Node
- Listing Versions
- Setting Custom Colors
- Persisting custom colors
- Suppressing colorized output
- Restoring PATH
- Set default node version
- Use a mirror of node binaries
- Pass Authorization header to mirror
- Platforms without official binaries
- .nvmrc
- Deeper Shell Integration
- Calling nvm use automatically in a directory with a .nvmrc file
- bash
- zsh
- fish
- Running Tests
- Environment variables
- Bash Completion
- Usage
- Compatibility Issues
- Installing nvm on Alpine Linux
- Alpine Linux 3.13+
- Alpine Linux 3.5 - 3.12
- Uninstalling / Removal
- Manual Uninstall
- Docker For Development Environment
- Problems
- macOS Troubleshooting
- WSL Troubleshooting
- Maintainers
- Project Support
- Enterprise Support
- License
- Copyright notice
Intro
nvm allows you to quickly install and use different versions of node via the command line.
Example:
sh
$ nvm install 24
Now using node v24.14.0 (npm v11.9.0)
$ node -v
v24.14.0
$ nvm use 22
Now using node v22.22.1 (npm v10.9.4)
$ node -v
v22.22.1
$ nvm use 20
Now using node v20.20.1 (npm v10.8.2)
$ node -v
v20.20.1
Simple as that!
About
nvm is a version manager for node.js, designed to be installed per-user, and invoked per-shell. nvm works on any POSIX-compliant shell (sh, dash, ksh, zsh, bash), in particular on these platforms: unix, macOS, and Windows WSL.
Installing and Updating
Install & Update Script
To install or update nvm, you should run the [install script][2]. To do that, you may either download and run the script manually, or use the following cURL or Wget command:
sh
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.41.0/install.sh | bash
sh
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.41.0/install.sh | bash
Running either of the above commands downloads a script and runs it. The script clones the nvm repository to ~/.nvm, and attempts to add the source lines from the snippet below to the correct profile file (~/.bashrc, ~/.bash_profile, ~/.zshrc, or ~/.profile). If you find the install script is updating the wrong profile file, set the $PROFILE env var to the profile file’s path, and then rerun the installation script.
sh
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "Top issues
#651Use package.json engines version?175 comments · 2015-02-10#400How to update nvm76 comments · 2014-04-23#794Honor .node-version file68 comments · 2015-08-04#1985 sourcing nvm.sh exits with code 3 when .nvmrc is present and version is not installed56 comments · 2019-01-19#2486HEAD detached at FETCH_HEAD51 comments · 2021-04-15#303NVM in fish47 comments · 2013-10-10#1290npm is only available in interactive shell33 comments · 2016-11-07#2458"No such file or directory" when there is indeed such a file "node"28 comments · 2021-03-05
Latest release
v0.41.0 v0.41.0 2026-11-04New Stuff - select versions by category: alpha, lts, non-lts, iojs; exclude alphas by default - nvm alias: store --lts and --lts= - record every node version's LTS status - nvm ls-remote: annotate versions with the node alias and local aliases (3920) - add nvm_has_italics, to detect terminal italics support via terminfo Bug Fixes - nvm: treat a bare --only like an empty --only= - nvm_ls_remote, nvm_remote_version: match dots between version components literally (3982) - nvm_nvmrc_invalid_msg: respect --silent - nvm_download: pass $NVM_AUTH_HEADER to curl and GNU Wget in a
相关报道 (5)
News & coverage (6)
Hacker NewsNVM – Package for Ubuntu PPA and Backport▲ 1 · 1 comments · 2021-07-03HostingerHow to deploy a Node.js application2026-04-07SitePointQuick Tip: How to Install Node.js on Debian2023-10-25MakeUseOfHow to Downgrade to a Previous Node.js Version Using NVM2023-05-12MakeUseOfLearn How to Install Npm and Node.js on Ubuntu2021-08-20Black Hills Information SecurityMachine-in-the-Middle (MitM) BLE Attack2020-10-28