1、先安装nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
#或者 如果wget不存在 执行yum -y install wget
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
2、在bashrc里面写下相关配置
#编辑文件
vim ~/.bashrc
#写入配置
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
3、刷新配置即可正常使用
#刷新配置
source ~/.bashrc
#判断nvm是否安装
nvm -v
4、使用nvm下载相关node版本
nvm install 14.13.2
#nvm常用命令
nvm uninstall 14.13.2 // 移除 node 6.11.0
nvm use 14.13.2 // 使用 node 6.11.0
nvm ls // 查看目前已安装的 node 及当前所使用的 node
nvm ls-remote // 查看目前线上所能安装的所有 node 版本
nvm alias default 14.13.2 // 使用 6.11.0 作为预设使用的 node 版本