node.js - 由于 NO_PUBKEY 未找到错误,无法在 Ubuntu 18.04.5 LTS 上安装 NodeJS 14 或 16

标签 node.js linux ubuntu

我的目标是安装 NodeJS。这是我正在运行的命令:

curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -

由于以下错误而失败:

W: GPG error: https://releases.parity.io/deb release InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B1FE9FFD0787F8B

完整的堆栈跟踪可在附录 A 中找到。

我尝试解决这个关键问题并运行以下命令:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B1FE9FFD0787F8B

结果是由于缺少 key 而未检查一些签名,完整的堆栈跟踪可在附录 B 中找到。

然后,当我尝试使用命令 sudo apt-get update 更新系统时,出现错误:无法验证以下签名,因为公钥是不可用:NO_PUBKEY 3B1FE9FFD0787F8B。完整的堆栈跟踪可在附录 C 中找到。

如何解决 gpg key 错误以便安装 NodeJS14 或更高版本?

附录 A

root@vultr:~# curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -

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


## Populating apt-get cache...

+ apt-get update
Hit:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
Get:2 https://releases.parity.io/deb release InRelease [1,468 B]
Hit:3 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:4 http://ppa.launchpad.net/webupd8team/y-ppa-manager/ubuntu bionic InRelease
Hit:5 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Err:2 https://releases.parity.io/deb release InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B1FE9FFD0787F8B
Hit:6 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Reading package lists... Done
W: GPG error: https://releases.parity.io/deb release InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B1FE9FFD0787F8B
E: The repository 'https://releases.parity.io/deb release InRelease' is not signed.
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 the command, exiting

附录 B

Executing: /tmp/apt-key-gpghome.bZCjA8xQN8/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys 3B1FE9FFD0787F8B
gpg: key FF0812D491B96798: 3 duplicate signatures removed
gpg: key FF0812D491B96798: 8 signatures not checked due to missing keys
gpg: key FF0812D491B96798: "Parity Security Team <<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3e4d5b5d4b4c574a477e4e5f4c574a47105751" rel="noreferrer noopener nofollow">[email protected]</a>>" not changed
gpg: Total number processed: 1
gpg:              unchanged: 1

附录 C

Hit:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
Get:2 https://releases.parity.io/deb release InRelease [1,468 B]
Hit:3 http://ppa.launchpad.net/webupd8team/y-ppa-manager/ubuntu bionic InRelease
Err:2 https://releases.parity.io/deb release InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B1FE9FFD0787F8B
Hit:4 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:5 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:6 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Reading package lists... Done
W: GPG error: https://releases.parity.io/deb release InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B1FE9FFD0787F8B
E: The repository 'https://releases.parity.io/deb release InRelease' is not signed.
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.

更新 1:将 -k 添加到 curl:

root@vultr:~# curl -k -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -

它没有改变任何东西:

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


## Populating apt-get cache...

+ apt-get update
Get:1 https://releases.parity.io/deb release InRelease [1,468 B]
Hit:2 http://ppa.launchpad.net/webupd8team/y-ppa-manager/ubuntu bionic InRelease
Err:1 https://releases.parity.io/deb release InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B1FE9FFD0787F8B
Get:3 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Hit:4 http://archive.ubuntu.com/ubuntu bionic InRelease
Get:5 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:6 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Reading package lists... Done
W: GPG error: https://releases.parity.io/deb release InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B1FE9FFD0787F8B
E: The repository 'https://releases.parity.io/deb release InRelease' is not signed.
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```

最佳答案

显然releases.parity.io/deb 是未签名的或者什么的。 This答案建议您可以将 [trusted=yes] 添加到 /etc/apt/sources.list 以避免遇到此错误。

我无法就其安全性提出建议。

编辑:

搜索以

开头的行
deb https://releases.parity.io/deb

并将其更改为

deb [trusted=yes] https://releases.parity.io/deb

链接答案中提到的其他替代方案也可能值得一试。

更新 1:在正确的文件中添加 [trusted=yes]

文件 /etc/apt/sources.list.d/parity.list 包含以下行: deb [signed-by=/usr/share/keyrings/parity.gpg] https://releases.parity.io/deb 发行版主。 应修改此行以使其正常工作: deb [trusted=yes,signed-by=/usr/share/keyrings/parity.gpg] https://releases.parity.io/deb 发行版主

关于node.js - 由于 NO_PUBKEY 未找到错误,无法在 Ubuntu 18.04.5 LTS 上安装 NodeJS 14 或 16,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69701205/

相关文章:

linux - 在 Linux 上使用 Haskell 获取前台窗口标题

node.js - SLIMERJSLAUNCHER 环境变量丢失。将其设置为 Firefox 或 XulRunner 的路径

linux - VPS inode 达到限制 - 应删除/删除哪些文件以释放 inode

node.js - 如何从 Node 应用程序打开 ec2 上的 http 流量端口?

linux - Praat 脚本在 Ubuntu 中抛出 "unknown function"错误

linux - random() 在 Linux 中函数相同的值(同时 grof ing)

node.js - 高级 Node 和快速 FCC 挑战中的数据库连接错误 - 护照用户的序列化

node.js - RailJS 与 TowerJS

node.js - 在 Backbone 和 RequireJS 中使用listenTo

shell - 获取发送到电子邮件的回显 cron 文本