1、打开 https://github.com/nvm-sh/nvm
2、下载zip包
3、执行脚本:nvm-master/install.sh
4、如果出现:
=> Profile not found. Tried ~/.bashrc, ~/.bash_profile, ~/.zshrc, and ~/.profile.
5、touch ~/.bash_profile
6、执行3;
7、根据提示执行:
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
8、输入命令nvm
9、安装成功;
10、安装node:nvm install 12.16.0
11、切换版本:nvm use 12.16.0