Repository: nodesource/distributions

Issue #1755: Wiki documentation for pinned node versions causes GPG key conflict.
Created: 2024-01-08T13:24:45Z
The Wiki indicates that the install script should not be used when pinning a Node version. It makes sense, because the install script always installs the latest minor version of a given major. When following the pinned node version documentation - one ends up with a GPG key conflicts because of different gpg keys that are used for the rpm and the binary.
One thing that the install script does, is update the GPG key from the default rpm key to https://rpm.nodesource.com/gpgkey/ns-operations-public.key.
Distribution Information:

OS: RPM-based Linux

Node Version:

Node: 20.10.0

To Reproduce
Steps to reproduce the behavior:

Follow Wiki to setup the fetching of a pinned node version, f.ex 20.10.0:

# install Node.js
NODEJS_VERSION=20.10.0 && \
(NODEJS_MAJOR_VERSION="${NODEJS_VERSION:0:2}" && \
dnf install https://rpm.nodesource.com/pub_$NODEJS_MAJOR_VERSION.x/nodistro/repo/nodesource-release-nodistro-1.noarch.rpm -y) && \
dnf install nodejs-$NODEJS_VERSION-1nodesource --setopt=nodesource-nodejs.module_hotfixes=1 -y 
Expected behavior
Installation should either succeed with the standard repo GPG key or the wiki instructions could include the step to update the repo with a custom gpg key as the setup_20.x script does.

Duplicate issue #1747: [ERROR] Node.js 20.x on amazonlinux:2023 Installation fail: GPG check FAILED
Created: 2024-01-03T07:25:16Z
Installation of Node.js 20.x from nodesource fails on "GPG check FAILED"
The exact same steps were working until yesterday (Jan 2 2024) - the Dockerfile has not changed.
The error is:
#18 [stage-1  6/49] RUN dnf install nodejs -y --setopt=nodesource-nodejs.module_hotfixes=1
#18 6.550 nodejs-20.10.0-1nodesource.x86_64.rpm           9.3 MB/s |  36 MB     00:03
#18 6.552 --------------------------------------------------------------------------------
#18 6.553 Total                                           9.2 MB/s |  36 MB     00:03
#18 6.711 Node.js Packages for Linux RPM based distros -  1.6 MB/s | 1.7 kB     00:00
#18 6.768 Importing GPG key 0x9B1BE0B4:
#18 6.768  Userid     : "NSolid <nsolid-gpg@nodesource.com>"
#18 6.768  Fingerprint: 6F71 F525 2828 41EE DAF8 51B4 2F59 B5F9 9B1B E0B4
#18 6.768  From       : /etc/pki/rpm-gpg/NODESOURCE-NSOLID-GPG-SIGNING-KEY-EL
#18 6.792 Key imported successfully
#18 6.996 Import of key(s) didn't help, wrong key(s)?
#18 6.997 Public key for nodejs-20.10.0-1nodesource.x86_64.rpm is not installed. Failing package is: nodejs-2:20.10.0-1nodesource.x86_64
#18 6.997  GPG Keys are configured as: file:///etc/pki/rpm-gpg/NODESOURCE-NSOLID-GPG-SIGNING-KEY-EL
#18 6.998 The downloaded packages were saved in cache until the next successful transaction.
#18 6.998 You can remove cached packages by executing 'dnf clean packages'.
#18 7.019 Error: GPG check FAILED
#18 ERROR: process "/bin/sh -c dnf install nodejs -y --setopt=nodesource-nodejs.module_hotfixes=1" did not complete successfully: exit code: 1

Distribution Information:

OS: amazonlinux:2023 (Docker)
Version: nodejs-20.10.0-1nodesource.x86_64.rpm
Other info if applicable: Docker image amazonlinux:2023

Node Version:

Node: Node.js v20.x

To Reproduce
Steps to reproduce the behavior:
FROM amazonlinux:2023
RUN dnf remove -y nodejs npm
RUN dnf install https://rpm.nodesource.com/pub_20.x/nodistro/repo/nodesource-release-nodistro-1.noarch.rpm -y
RUN dnf install nodejs -y --setopt=nodesource-nodejs.module_hotfixes=1

Expected behavior
Installation succeeds, as it did until Jan 2 2024.
Update
Using the following steps seems to fix the problem:
RUN curl -fsSL https://rpm.nodesource.com/setup_20.x | bash -
RUN dnf install -y nodejs

I am not sure where the previous steps came from - perhaps when the nodesource "regular" install was not properly supporting amazonlinux:2023
If the old steps are invalid and the correct steps now work, perhaps this can be closed.

Closing comment (2024-01-09T08:05:43Z): I'm facing the same issue recently on AL2023 (since 2024, before it worked fine), and followed the instructions mentioned on https://github.com/nodesource/distributions/wiki/How-to-select-the-Node.js-version-to-install to pin to a specific node version.
Any help is appreciated.
RUN yum install -q -y https://rpm.nodesource.com/pub_20.x/nodistro/repo/nodesource-release-nodistro-1.noarch.rpm && \
  yum install -q -y nodejs-20.9.0-1nodesource --setopt=nodesource-nodejs.module_hotfixes=1

Seems like a duplicate of #1755