我正在尝试安装 nodejs 和 npm,但是失败了。这是我的终端:
sudo apt-get install nodejs 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:
nodejs : Conflicts: npm
E: Unable to correct problems, you have held broken packages.
该怎么办?我有点迷茫了 :(
答案1
答案2
听起来你已经安装了其中一个 nodejs PPA。我使用的那个 PPA 已npm
作为软件包的一部分分发nodejs
,因此不可能也没有必要同时安装这两个 PPA。
安装nodejs
并查看是否可以运行npm
。
答案3
您应该遵循Node.js 指南
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs