首页 文章

Nodejs在ubuntu上安装问题

提问于
浏览
1

我在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 回答

  • 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
    

    Note

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

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

相关问题