小编典典

在 Ubuntu 上安装 Node.js

all

我正在尝试在Ubuntu
12.10

(Quantal Quetzal) 上安装 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,但我不知道如何解决它。


阅读 70

收藏
2022-06-28

共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 上安装当前稳定的节点。Quantal (12.10) 用户可能需要安装 software-properties-
common 软件包才能使add-apt-repository命令工作:sudo apt-get install software- properties-common

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

不给sudo apt-get install nodejs npm。只是sudo apt-get install nodejs

2022-06-28