我需要运行 nodejs v10.14。我目前正在运行版本 8.16.0。我找到了一些我遵循的说明,但它会导致错误(见下文)。
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
This causes the following output:
## Installing the NodeSource Node.js 10.x repo...
## Populating apt-get cache...
+ apt-get update
Hit:29 http://ppa.launchpad.net/wireshark-dev/stable/ubuntu bionic InRelease
Err:31 http://ppa.launchpad.net/ehoover/compholio/ubuntu bionic Release
404 Not Found [IP: 91.189.95.83 80]
Err:32 http://ppa.launchpad.net/pipelight/stable/ubuntu bionic Release
404 Not Found [IP: 91.189.95.83 80]
Reading package lists... Done
E: The repository 'http://ppa.launchpad.net/ehoover/compholio/ubuntu bionic Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://ppa.launchpad.net/pipelight/stable/ubuntu bionic Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
Error executing command, exiting
知道如何安装 nodejs v10.14(或更高版本)吗?
答案1
您的错误似乎是在建立 APT 缓存时出现的问题 - curl 中的链接没有响应有效(请参阅错误堆栈中的 404 错误)...
如果是连接问题,不确定这是否真的有效,但您可以尝试删除 nodejs 安装,更新您的软件包,然后使用 teh 12.x curl 重新安装 nodejs 12.x。
要删除并重新安装 Node 和 NPM:
首先删除节点:
sudo apt-get remove nodejs npm
然后更新并升级:
sudo apt-get update
sudo apt-get upgrade
然后获取你想要的 Node 版本:
//where setup_12.x, replace with desired major version
curl -sL deb.nodesource.com/setup_12.x | sudo -E bash -
然后安装新的节点版本:
sudo apt-get install -y nodejs
这样就行了。您可以通过以下方式检查当前版本:
node -v
npm -v
希望这可以帮助!