无法解决“E:无法纠正问题,您持有破损的包裹。”

无法解决“E:无法纠正问题,您持有破损的包裹。”

在 Ubuntu 12.04 中,我尝试使用 npm 安装 less 和处理程序。安装 npm 时我发现此错误

sudo apt-get install npm
Reading package lists... Done
Building dependency tree       
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: nodejs-dev (>= 0.4)
E: Unable to correct problems, you have held broken packages.

请帮我解决这个问题。谢谢你的帮助。

答案1

看起来该版本的 npm 不再受支持,更新节点(和 npm)解决了该问题。

首先,卸载过时的版本(可选,但我认为这解决了我遇到的全局模块未被路径化的问题)。

sudo apt-get purge nodejs npm

然后从 Chris Lea 的 repo 安装:

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

相关内容