Ubuntu的易于得到的NPM未满足的依赖

问题描述 投票:2回答:5

我试图安装NPM。要做到这一点,我跑:

sudo apt-get install nodejs

这种成功合作。然后我跑:

sudo apt-get install npm

 Reading state information... Done
 Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming.
 The following information may help to resolve the situation:

 The following packages have unmet dependencies:
  npm : Depends: node-gyp (>= 0.10.9) but it is not going to be installed
 E: Unable to correct problems, you have held broken packages.

试图安装节点GYP领导下“满足的依赖关系”的循环路径。

我跟着这些指示,并有0没有升级包; https://askubuntu.com/questions/140246/how-do-i-resolve-unmet-dependencies-after-adding-a-ppa

我禁用了所有其他软件来源,仍然有问题。我一直运行到这个问题,其他软件包(HHVM和单声道)。我能做些什么来解决这些问题?

node.js ubuntu npm apt-get
5个回答
4
投票

安装NPM时,我正好有同样的症状和错误信息。

请参阅Node Package Manager got corrupted

你可以做以下

sudo apt-get remove nodejs npm ## remove existing nodejs and npm packages
sudo apt-get install curl  
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs  

这适用于我的Ubuntu 16.04.2


1
投票

sudo apt-get cleansudo apt-get -f install

clean清除的.deb文件进行本地缓存。

-f指“修复损坏”。


1
投票

这是因为是的NodeJS已经安装在比最新的Ubuntu,可能从PPA的新版本。如果您删除当前和的NodeJS安装被Ubuntu提供的一个,那么你可以安装NPM。

您对使用dpkg避免删除依赖其删除:

sudo dpkg -r --force-depends nodejs

1
投票

在Ubuntu 18.04我已经安装的软件包,阻止NPM依赖的安装:

# apt install npm
...
 npm : Hängt ab von: node-gyp (>= 0.10.9) soll aber nicht installiert werden

# apt install node-gyp
...
 node-gyp : Hängt ab von: nodejs-dev soll aber nicht installiert werden

# apt install node-gyp nodejs-dev
...
 nodejs-dev : Hängt ab von: libssl1.0-dev (>= 1.0.2) soll aber nicht installiert werden

# apt install node-gyp nodejs-dev libssl1.0-dev
...
Die folgenden Pakete werden ENTFERNT:
  libcurl4-openssl-dev libneon27-dev libssl-dev

所以,问题是,我已经安装了这三个包:

libcurl4-openssl-dev libneon27-dev libssl-dev

移除它们之后,我可以毫无问题安装NPM。


0
投票

运行npm install,执行以下步骤可帮助之前:

删除使用rm -rf node_modules/运行npm cache clean node_modules

© www.soinside.com 2019 - 2024. All rights reserved.