光轨资源网 / 开源项目
nvm-sh/nvm
Node 版本管理器 符合 POSIX 标准的 bash 脚本,用于管理多个活动的 node.js 版本。
可以做什么
nvm 允许您通过命令行快速安装和使用不同版本的 Node。
怎么部署
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:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.41.0/install.sh | bash
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.
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
Additional Notes
- If the environment variable
$XDG_CONFIG_HOMEis present, it will place thenvmfiles there. - You can add
--no-useto the end of the above script to postpone usingnvmuntil you manually [use](#usage) it:
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" --no-use # This loads nvm, without auto-using the default version
`
## 项目信息
**项目地址**:https://github.com/nvm-sh/nvm
**语言**:Shell
**Star 数**:95913(2026-11-12 采集)
## 原文简介(English)
Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions.
本站资源用于学习与开发参考,请遵守对应授权协议。