无法在 18.04 中更新 nodejs

无法在 18.04 中更新 nodejs

--with-new-pkgs当我尝试在 Ubuntu 18.04 中更新 nodejs 和 nodejs-dev(带选项)时收到此消息。

 The following packages have unmet dependencies:
 libssl-dev : Conflicts: libssl1.0-dev but 1.0.2n-1ubuntu5.1 is going to be installed
              Recommends: libssl-doc but it is not going to be installed
 libssl1.0-dev : Conflicts: libssl-dev but 1.1.0g-2ubuntu4.1 is going to be installed
E: Broken packages 

答案1

使用来自npm为了升级节点

sudo npm cache clean -f
sudo npm install -g n
sudo n stable

要升级到最新版本(而不是当前稳定版本),您可以使用

sudo n latest

撤销:

sudo apt-get install --reinstall nodejs-legacy     # fix /usr/bin/node
sudo n rm 6.0.0     # replace number with version of Node that was installed
sudo npm uninstall -g n

相关内容