在Ubuntu上解决Node.js版本冲突,可使用以下方法:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
安装NVM,安装后使用nvm install <version>
安装所需版本,nvm use <version>
切换版本。curl -fsSL https://deb.nodesource.com/setup_<version>.x | sudo -E bash -
添加对应版本的PPA,再用sudo apt-get install -y nodejs
安装。sudo mv
移动到安装目录,配置环境变量即可。