Skip to content

[ERROR] Node.js 20 on Ubuntu22 Installation fail #1780

@carefreepineapple

Description

@carefreepineapple

Describe your bug
Cant install nodejs 20 on ubuntu 22 (nodejs 18 fails as well)

Err:1 https://deb.nodesource.com/node_20.x nodistro InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 2F59B5F99B1BE0B4

Distribution Information:

~$ cat /etc/os-release | grep VERSION=
VERSION="22.04.4 LTS (Jammy Jellyfish)"

Node Version:

  • Node: Node.js 20.x
  • Node: Node.js 18.x

To Reproduce
Steps to reproduce the behavior:

curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - &&\
sudo apt-get install -y nodejs

Expected behavior
Node.js 20.x to be installed.

Additional context
Nodejs.18x was originally installed.

Steps done to remove nodejs.x thus far

~$ sudo rm /etc/apt/sources.list.d/nodesource.list
~$ sudo rm /usr/share/keyrings/nodesource.gpg
~$ sudo rm /etc/apt/keyrings/nodesource.gpg
~$ sudo apt purge libnode72 node-*
~$ sudo apt remove nodejs libnode72 libnode-dev nodejs-doc
~$ sudo rm `sudo find / -name nodesource.gpg`
~$ sudo rm `sudo find / -name nodesource.key`
~$ sudo find /etc -name "*node*" -type f -delete
~$ sudo find /usr/bin -name 'node*' -exec rm -rf {} \;
~$ sudo find /usr/local/bin -name 'node*' -exec rm -rf {} \;
~$ sudo rm -rf ~/.npm ~/.node-gyp ~/.npmrc ~/.npm-init.js /usr/local/lib/node_modules
~$ sudo find /usr -name 'node*' -type d -exec rm -rf {} \;
~$ sudo find /usr/local -name 'node*' -type d -exec rm -rf {} \;
~$ sudo apt autoremove -y
~$ sudo apt --fix-broken install
~$ sudo apt-get clean
~$ sudo apt update -y
~$ sudo apt upgrade -y

Steps done to install nodejs and verification

~$ curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -

# verify source file contents, specifically the path for the gpg key 
~$ sudo cat /etc/apt/sources.list.d/nodesource.list
deb [arch=amd64 signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main

# make sure the gpg key has the correct permissions
~$ sudo chmod a+r /usr/share/keyrings/nodesource.gpg

# make sure the gpg key has the correct key
~$ sudo gpg --show-keys --with-subkey-fingerprint /usr/share/keyrings/nodesource.gpg
pub   rsa2048 2016-05-23 [SC]
      6F71F525282841EEDAF851B42F59B5F99B1BE0B4
uid                      NSolid <nsolid-gpg@nodesource.com>
sub   rsa2048 2016-05-23 [E]
      0FA5ECC8C0CA58863C0AC5867E9656125E955B26

# verify the hosted key has the same signature
~$ curl -fsSL --compressed   "https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key" | gpg --dry-run --show-keys -
gpg: keyblock resource '/home/ansible/.gnupg/pubring.kbx': No such file or directory
pub   rsa2048 2016-05-23 [SC]
      6F71F525282841EEDAF851B42F59B5F99B1BE0B4
uid                      NSolid <nsolid-gpg@nodesource.com>
sub   rsa2048 2016-05-23 [E]

# tried downloading the key manually, no change.
~$ sudo curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/nodesource.gpg

# tried making a symlink to /etc/apt/keyrings just in case, no change.
~$ ln -s /usr/share/keyrings/nodesource.gpg /etc/apt/keyrings/

# nodesource.gpg has all the same permissions as the other gpg files.
~$ sudo ls -la /usr/share/keyrings/nodesource.gpg
-rw-r--r-- 1 root root 1185 Mar  1 05:53 /usr/share/keyrings/nodesource.gpg

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions