Ricardo

NVM 安装与常用命令

阅读时长: 1 分钟

#nvm #install

nvm-github

安装或更新

安装或更新脚本

安装 nvm或者更新nvm可以直接执行下列命令

Bash
1
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
Bash
1
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/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 (~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc). 脚本逻辑:将 nvm 存储库克隆到“~/.nvm”,并尝试将下面代码片段中的源代码行添加到正确的配置文件(“~/.bash_profile”、“~/.zshrc”、“~/.profile”) ,或~/.bashrc`)。

Bash
1
2
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
nvm 常用命令
  • nvm install stable 安装最新稳定版node
  • nvm install <version> 安装指定版本,如:安装v14.4.0,nvm install v14.4.0
  • nvm uninstall <version> 删除已安装的指定版本,语法与install类似
  • nvm use <version> 切换使用指定的版本node
  • nvm ls 列出所有安装的版本
  • nvm alias default <version> 如: nvm alias default v11.1.0
Licensed under CC BY-NC-SA 4.0
comments powered by Disqus
记录自己
Built with Hugo
主题 Stack 由 Jimmy 设计