MAC安装nvm

从git安装

  1. git下载nvm仓库到~/.nvm
cd ~/ 
git clone https://github.com/nvm-sh/nvm.git
.nvm

如果下载很慢,可以通过下面链接网盘下载
链接: 百度网盘 请输入提取码 密码: q7fc

  1. 将下面的代码添加到 ~/.bashrc~/.profile, or ~/.zshrc
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

执行source命令, 如 source ~/.zshrc

使用

# 安装最新版
nvm install node # "node" is an alias for the latest version

# 安装指定版本
nvm install 6.14.4 # or 10.10.0, 8.9.1, etc

# 列出本地安装的版本
nvm ls

# 列出远程可用版本
nvm ls-remote

# 选择版本
nvm use node # 6.14.4

参考

nvm

猜你喜欢

转载自blog.csdn.net/qq_28505809/article/details/125070350