安装NodeJS时出现“Error Executing Command, Exiting”错误

Hay*_*den 4 node.js ubuntu-16.04

我正在使用 Ubuntu 16.04LTS。我在终端中输入了以下命令:

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
Run Code Online (Sandbox Code Playgroud)

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

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
Run Code Online (Sandbox Code Playgroud)

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

Cle*_*leb 5

我遇到过同样的问题。问题不在于nodejs安装脚本,而在于/etc/apt/sources.list.

以下对我有用:

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

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bu
Run Code Online (Sandbox Code Playgroud)

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

sudo nano /etc/apt/sources.list
Run Code Online (Sandbox Code Playgroud)

并删除

http://ppa.launchpad.net/tualatrix/next/ubuntu/dists/xenial/main/binary-amd64/Packages
Run Code Online (Sandbox Code Playgroud)

部分。就我而言,是 Skype 导致了问题;您可以通过以E: Failed to fetch.

之后,以下工作正常(取自安装说明):

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
Run Code Online (Sandbox Code Playgroud)

如果一个然后输入

nodejs -v
Run Code Online (Sandbox Code Playgroud)

它会回来

v8.9.4
Run Code Online (Sandbox Code Playgroud)

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

如果您已经安装了anaconda,我建议将其安装node.js在一个可以保持干净的环境中。可以在此处找到有关如何执行此操作的详细说明。基本上它所需要的是

conda create -n webdev nodejs
Run Code Online (Sandbox Code Playgroud)

加上所需的 python 模块,以防您想使用 egFlaskDjango.