"执行命令,退出"时出错安装NodeJS时出错

时间:2018-02-08 17:17:13

标签: node.js ubuntu-16.04

我使用的是Ubuntu 16.04LTS。 我在终端输入以下命令:

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -

作为回报,我收到以下错误:

Reading package lists... Done
W: The repository 'http://ppa.launchpad.net/tualatrix/next/ubuntu xenial Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: The repository 'http://ppa.launchpad.net/tualatrix/ppa/ubuntu xenial Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch http://ppa.launchpad.net/tualatrix/next/ubuntu/dists/xenial/main/binary-amd64/Packages  404  Not Found
E: Failed to fetch http://ppa.launchpad.net/tualatrix/ppa/ubuntu/dists/xenial/main/binary-amd64/Packages  404  Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.
Error executing command, exiting

我刚从Ubuntu存储库安装了旧版本的NodeJS和NPM,因为我无法安装最新版本。但是,我仍然需要最新版本的Node和NPM。

1 个答案:

答案 0 :(得分:3)

我有同样的问题。问题不是nodejs安装脚本,而是/etc/apt/sources.list中包列表中的另一个包。

以下对我有用:

1)创建文件/etc/apt/sources.list的备份只是为了安全起见:

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bu

2)删除导致问题的包裹:
使用root权限打开/etc/apt/sources.list,例如

sudo nano /etc/apt/sources.list

并删除

http://ppa.launchpad.net/tualatrix/next/ubuntu/dists/xenial/main/binary-amd64/Packages

份。在我的情况下,skype引起了这个问题;您可以通过以E: Failed to fetch开头的行识别关键包。

之后,以下工作正常(取自installation instructions):

cd ~
curl -sL https://deb.nodesource.com/setup_8.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt-get install nodejs
sudo apt-get install build-essential

然后输入

nodejs -v

它会返回

v8.9.4

(或您指定的任何版本)。

如果您已经安装了anaconda,我建议在保持干净的环境中安装node.js。有关如何执行此操作的详细说明,请参见here。基本上它只需要

conda create -n webdev nodejs

加上所需的python模块,以防您想使用例如FlaskDjango