NVM For Mac / Linux 下载压缩包
cd /
wget https://github.com/nvm-sh/nvm/archive/refs/tags/v0.39.1.tar.gz
解压
mkdir -p /.nvm
tar -zxvf nvm-0.39.1.tar.gz -C /.nvm
配置环境
vim ~/.bashrc
在~/.bashrc的末尾,添加如下语句:
export NVM_DIR="$HOME/.nvm/nvm-0.38.0"
[ -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 ~/.bashrc
使用NVM安装node v14.17.3
nvm install 14.17.3
切换node版本
nvm use 14.17.3