Nodejs install fail

[yani@maud ~]$ sudo dnf install nodejs
Last metadata expiration check: 0:16:27 ago on Fri 12 Apr 2024 23:24:32.
Dependencies resolved.
==================================================================================================================================================
 Package                     Architecture                Version                                     Repository                              Size
==================================================================================================================================================
Installing:
 nodejs                      x86_64                      2:18.20.2-1nodesource                       nodesource-nodejs                       34 M

Transaction Summary
==================================================================================================================================================
Install  1 Package

Total size: 34 M
Installed size: 98 M
Is this ok [y/N]: y
Downloading Packages:
[SKIPPED] nodejs-18.20.2-1nodesource.x86_64.rpm: Already downloaded                                                                              
Node.js Packages for Linux RPM based distros - x86_64                                                             1.6 MB/s | 1.7 kB     00:00    
Importing GPG key 0x9B1BE0B4:
 Userid     : "NSolid <nsolid-gpg@nodesource.com>"
 Fingerprint: 6F71 F525 2828 41EE DAF8 51B4 2F59 B5F9 9B1B E0B4
 From       : /etc/pki/rpm-gpg/NODESOURCE-NSOLID-GPG-SIGNING-KEY-EL
Is this ok [y/N]: y
warning: Signature not supported. Hash algorithm SHA1 not available.
Key import failed (code 2). Failing package is: nodejs-2:18.20.2-1nodesource.x86_64
 GPG Keys are configured as: file:///etc/pki/rpm-gpg/NODESOURCE-NSOLID-GPG-SIGNING-KEY-EL
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.
Error: GPG check FAILED

Any clues?

It looks like you’re trying to install a non Rocky version of node.js

Clearly not by the dnf etc…

It could be that the software I was installing tried to add Node, it failed but perhaps in failing left unwanted items behind?

You have to be careful installing anything that’s not in the official repos, try running
dnf repolist all
to check if you have any unofficial repos, then try to clean up any packages that were installed from them, at that point, you’d be back to normal Rocky.

You should be using the current LTS versions of nodejs/npm.

Installing via the NodeSource repo would only be necessary if you require an old version for developement work.

1 Like

The Red Hat solution worked. Thanks… highlight that solution for the next one.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.