以下软件包具有未满足的依赖项:nodejs:冲突:npm


17

我遵循了这个要旨https://gist.github.com/Goddard/5500157来安装nodejs和npm,但是运行它之后,既不能运行node --version也不可以运行npm --version,从而导致找不到命令错误。我能够卸载nodejs,但是必须进入脚本中描述的temp目录并进行make卸载才能使npm离开。

现在,尝试再次安装nodejs和npm时,我改用此链接http://www.andreagrandi.it/2013/02/08/how-to-install-latest-stable-node-js-on-ubuntu/,但是,如果我尝试同时安装nodejs和npm,则会收到此错误消息。

sudo apt-get install nodejs npm

The following packages have unmet dependencies:
   nodejs : Conflicts: npm
E: Unable to correct problems, you have held broken packages.

如果我只是安装nodejs,那可以正常工作。

sudo apt-get install nodejs

node --version
v0.10.15

但是现在,如果我尝试安装npm,则会显示此错误消息

sudo apt-get install npm 

The following packages have unmet dependencies:
npm : Depends: nodejs (>= 0.6.19~dfsg1-3) but it is not going to be installed
   Depends: nodejs-dev
   Depends: node-node-uuid but it is not going to be installed
   Depends: node-request but it is not going to be installed
   Depends: node-mkdirp but it is not going to be installed
   Depends: node-minimatch but it is not going to be installed
   Depends: node-semver but it is not going to be installed
   Depends: node-ini but it is not going to be installed
   Depends: node-graceful-fs but it is not going to be installed
   Depends: node-abbrev but it is not going to be installed
   Depends: node-nopt but it is not going to be installed
   Depends: node-fstream but it is not going to be installed
   Depends: node-rimraf but it is not going to be installed
   Depends: node-tar but it is not going to be installed
   Depends: node-which but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

我正在使用Ubuntu 13.04。任何帮助表示赞赏。我对node.js和npm不太了解。我正在尝试开始学习如何使用这些功能,因此我的经验不足可能正在显示出来。


2
从v0.10.0开始,您从PPA安装的nodejs软件包包括npm。换句话说-您应该已经安装了npm(因为sudo apt-get install nodejs)。尝试运行npm进行确认。另请参阅官方安装指南(您遵循的是该指南的副本,但官方的指南还有一些其他详细信息)。
cyberx86

谢谢-对了,如果您只安装nodejs然后运行npm --version,一切都将正确运行。我没有考虑检查它们是否合并在一起,只是假设它们是分开的。
伐木工人

到2017年,仍然有可能达到这一点,对于非错误使用相同的令人困惑的错误消息:(
Efren

Answers:


18

nodejs从PPA安装的软件包npm自v0.10.0起包含。由于您拥有v0.10.15,因此在运行sudo apt-get install nodejs时还安装了npm。尝试运行npm以确认。

另请参阅官方安装指南(您遵循的是该指南的副本,但官方的指南还有一些其他详细信息)。


2
如果已经安装了npm,为什么会感到困惑?反正坏了吗?
伊夫伦

同样的情况,我通过安装curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -,已经安装了npm。
Nirojan Selvanathan
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.