I've followed the instructions shown at the links below, but I cannot get NodeJS v10 installed on RHEL7.

curl -sL https://rpm.nodesource.com/setup_10.x | sudo -E bash -
yum install nodejs

I am greeted with the following message:

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

## Inspecting system...

+ rpm -q --whatprovides redhat-release || rpm -q --whatprovides centos-release || rpm -q --whatprovides cloudlinux-release || rpm -q --whatprovides sl-release
+ uname -m

## Confirming "el7-x86_64" is supported...

+ curl -sLf -o /dev/null 'https://rpm.nodesource.com/pub_10.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm'

## Downloading release setup RPM...

+ mktemp
+ curl -sL -o '/tmp/tmp.p7C7NIfygt' 'https://rpm.nodesource.com/pub_10.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm'

## Installing release setup RPM...

+ rpm -i --nosignature --force '/tmp/tmp.p7C7NIfygt'
warning: /etc/yum.repos.d/nodesource-el7.repo created as /etc/yum.repos.d/nodesource-el7.repo.rpmnew

## Cleaning up...

+ rm -f '/tmp/tmp.p7C7NIfygt'

## Checking for existing installations...

+ rpm -qa 'node|npm' | grep -v nodesource

## Run `sudo yum install -y nodejs` to install Node.js 10.x and npm.
## You may also need development tools to build native addons:
     sudo yum install gcc-c++ make
## To install the Yarn package manager, run:
     curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
     sudo yum install yarn

Package matching 1:nodejs-6.16.0-1.el7.x86_64 already installed. Checking for update.
Nothing to do

And yum --showduplicates list nodejs |expand shows:

Installed Packages
nodejs.x86_64                  2:9.6.0-1nodesource                   @nodesource
Available Packages
nodejs.x86_64                  1:6.12.2-1.el7                        localepel  
nodejs.x86_64                  1:6.12.3-1.el7                        localepel  
nodejs.x86_64                  1:6.14.0-1.el7                        localepel  
nodejs.x86_64                  1:6.14.2-1.el7                        localepel  
nodejs.x86_64                  1:6.14.3-1.el7                        localepel  
nodejs.x86_64                  1:6.16.0-1.el7                        localepel 

And node -v shows:


Whatever I do, I can't seem to get v10 installed.



The problem I see is that this system previously had nodejs 9.x installed from nodesource, and neither the nodesource setup script nor a system administrator removed it and its repo before trying to install nodejs 10.

Worse, the script actually ignores this problem and tries to press on anyway, despite the fact that it can't possibly work. (This problem should be reported to its maintainers.)

To fix the problem, first remove the yum repo that provided nodejs 9.x, and then run the setup script for nodejs 10.x again.

yum remove $(rpm -qf /etc/yum.repos.d/nodesource.repo)

This should sufficiently clean up the system so that trying to install nodejs 10.x will succeed.

| improve this answer | |
  • Ah, thank you -- I thought it would overwrite/update or add an additional RPM source. I'll give it a try. – Josh M. Mar 7 '19 at 14:59
  • I really don't remember at this point.... – Josh M. Jul 12 at 1:14

NodeJs 10 isn't natively supported in RHEL7 (it is supported in RHEL8). You can try to manually install a CentOS 7 version

| improve this answer | |

After you remove the yum repo that provided node.js v9.x or previous, you need to run this command to clear the yum cache:

sudo yum clean all && sudo yum makecache fast

and then finally:

sudo yum install -y nodejs

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.