Git Install
If you have git installed (requires git v1.7.10+):
1,clone this repo in the root of your user profile
2,cd ~/ from anywhere then git clone https://github.com/nvm-sh/nvm.git .nvm
3,cd ~/.nvm and check out the latest version with git checkout v0.37.2
4,activate nvm by sourcing it from your shell: . nvm.sh
5,Now add these lines to your ~/.bashrc, ~/.profile, or ~/.zshrc file to have it automatically sourced upon login: (you may have to add to more than one of the above files)
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
然后查看一下nvm的版本
使用source命令来执行.sh的shell命令
然后把nvm软连接到系统环境中
nvm install 8.11.2 //安装8.11.2版本的node版本
use 8.11.2 //使用8.11.2版本的node