Nodejs在ubuntu

时间:2017-07-15 17:13:10

标签: node.js linux bash ubuntu

我在ubuntu上使用以下命令安装nodejs

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - sudo apt-get install -y nodejs

然后它给出了这条消息,

Reading package lists... Done
Building dependency tree       
Reading state information... Done
nodejs is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 253 not upgraded.
W: Duplicate sources.list entry https://dl.bintray.com/sbt/debian/  Packages (/var/lib/apt/lists/dl.bintray.com_sbt_debian_Packages)
W: You may want to run apt-get update to correct these problems

当我做“sudo apt-get update”时,我收到另一个错误,

W: Failed to fetch http://ppa.launchpad.net/chris-lea/node.js/ubuntu/dists/wily/main/binary-amd64/Packages  404  Not Found

W: Failed to fetch http://ppa.launchpad.net/chris-lea/node.js/ubuntu/dists/wily/main/binary-i386/Packages  404  Not Found

W: Failed to fetch http://ppa.launchpad.net/ole.wolf/rarcrack/ubuntu/dists/wily/main/binary-amd64/Packages  404  Not Found

W: Failed to fetch http://ppa.launchpad.net/ole.wolf/rarcrack/ubuntu/dists/wily/main/binary-i386/Packages  404  Not Found

E: Some index files failed to download. They have been ignored, or old ones used instead.

请您告诉我如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

发生错误是因为找不到您(或某些安装程序)添加到/etc/apt/sources.list的四个源链接并返回错误404.

如果所述条目不在/etc/apt/sources.list中,您可以在某个文件/etc/apt/sources.list.d/*.list中找到它们。

删除/etc/apt/sources.list(或某个文件/etc/apt/sources.list.d/*.list)中包含这些网址的行,并以官方方式安装Node.js:

https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

或者如果你想要版本6:

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs

注意

也许您遇到了这个问题,因为您的Ubuntu版本不受支持。 我不认为他们支持15.10,但只支持LTS版本(14.04& 16.04)。

如果可以,请升级到16.04然后重试。