curl命令安装
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash
或者 使用wget
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash
然后在下面配置文件中 (~/.bash_profile
, ~/.zshrc
, ~/.profile
, or ~/.bashrc
). 追加如下配置
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
然后 source 对应的文件
nvm用法
nvm list 当前安装了多少Node版本
nvm use 1.2 指定使用版本
nvm install 7.5.0 安装指定版本