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:
v9.6.0
Whatever I do, I can't seem to get v10 installed.
Sources:
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.
This should sufficiently clean up the system so that trying to install nodejs 10.x will succeed.
NodeJs 10 isn't natively supported in RHEL7 (it is supported in RHEL8). You can try to manually install a CentOS 7 version
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:
and then finally: