nodejs 10 顽固地安装在 ubuntu 20 中,即使在添加新版本 ppa 之后也是如此

nodejs 10 stubbornly installing in ubuntu 20 even after adding new verision ppa

我正在尝试安装来自 node.js 源官方 github repo. but after all running all commands yet, at apt-get install nodejs. system installs nodejs 10 version. I have already tried to 的 node.js 最新版本。但即使在 运行 宁和安装 software-common-properties 之后。没有任何变化。

当我运行curl -fsSL https://deb.nodesource.com/setup_17.x | sudo -E bash -出现的错误是:

## Installing the NodeSource Node.js 17.x repo...


## Populating apt-get cache...

+ apt-get update
Ign:1 http://download.webmin.com/download/repository sarge InRelease
Hit:2 http://download.webmin.com/download/repository sarge Release  
Hit:3 http://archive.ubuntu.com/ubuntu focal InRelease              
Hit:4 http://security.ubuntu.com/ubuntu focal-security InRelease    
Ign:5 http://ppa.launchpad.net/certbot/certbot/ubuntu focal InRelease
Hit:6 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:8 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:9 http://ppa.launchpad.net/ondrej/php/ubuntu focal InRelease
Err:10 http://ppa.launchpad.net/certbot/certbot/ubuntu focal Release
  404  Not Found [IP: 91.189.95.85 80]
Reading package lists... Done
E: The repository 'http://ppa.launchpad.net/certbot/certbot/ubuntu focal 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

请帮忙。谢谢。

当我在终端运行宁curl -fsSL https://deb.nodesource.com/setup_17.x | sudo -E bash -。然后命令由于某些原因没有成功并且失败了(下面有详细信息)。由于 apt repo 缓存中的 nodejs 版本没有更新。所以当我通过 运行ning apt-get install nodejs 安装 nodejs 时,它总是安装版本 10.

所以确保这个命令curl -fsSL https://deb.nodesource.com/setup_17.x | sudo -E bash -应该运行直到结束没有任何问题。在最后如果sudo apt-get install -y nodejs行出现然后your apt repo cache is updated。否则命令失败。

我的失败原因:
  • 我有 certbot installed/etc/apt/sources.list.d/ 目录中添加了一个源。问题不在于 certbot 安装本身,而在于其 apt 源 url。当 apt-get update 命令被 运行 执行时,正在寻找 certbot source,但在指定的 url 上找不到。所以它导致 404 并因此失败。所以我去了 /etc/apt/sources.list.d/certbot-ubuntu-certbot-focal.list 并评论了所有行(那里只有一行是活动的)。然后再次 运行 curl 命令。这次成功了。

所以我的建议是:

  • 确保 curl 命令正常工作。为此,我建议寻找失败的特定地方。我的意思是实际调试从 curl 命令加载的脚本。提到了很多 bash 命令,它们正在设置所有内容。