1.更新包
sudo apt update
2.安装nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
3.关闭并重新打开终端或者运行以下命令来启用nvm:
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
4.验证是否安装成功
nvm --version
5.查看可安装的node版本(如果执行只看到了iojs版本,请移步此处查看解决方案:https://www.cnblogs.com/lyt520/p/18416229)
nvm ls-remote
6.安装node版本
nvm install 14.18.2
7.nvm常用命令
// 已安装的node nvm ls // 切换node nvm use 14.18.2
标签:node,Debian,sh,bash,NVM,nvm,DIR From: https://www.cnblogs.com/lyt520/p/18416213