一尘不染

在Ubuntu上安装Node.js

node.js

我正在尝试在Ubuntu 12.10上安装Node.js,但是终端显示了有关丢失软件包的错误。我尝试了这个:

sudo apt-get install python-software-properties 
sudo add-apt-repository ppa:chris-lea/node.js 
sudo apt-get update 
sudo apt-get install nodejs npm

但是当我来到最后一行时sudo apt-get install nodejs npm显示此错误:

Failed to install some packages. This may mean that
you requested an impossible situation or if you are using the distribution
distribution that some required packages have not yet been created or been
been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
nodejs: Conflicts: npm
E: Failed to correct problems, you have held broken packages.

然后,我卸载了ppa:chris-lea/node.js,并尝试了第二种选择:

sudo apt-get install node.js
sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs npm

终端机说相同的错误,npm is the latest version但同时也向我显示了我在顶部显示的文本。我认为是问题所在,ppa:chris- lea/node.js但我不知道如何解决。


阅读 194

收藏
2020-07-07

共1个答案

一尘不染

只需按照此处给出的说明进行操作:

安装示例:

sudo apt-get install python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

它会在当前稳定的Ubuntu上安装当前稳定的Node。Quantal(12.10)用户可能需要安装software-properties-
common软件包才能使add-apt-repository命令起作用:sudo apt-get install software- properties-common

从Node.js v0.10.0开始,Chris Lea的仓库中的nodejs软件包包括npm和nodejs-dev。

不要sudo apt-get install nodejs npm只给sudo apt-get install nodejs

2020-07-07