16

I am trying to install node.js on Red Hat Enterprise Linux Server release 6.1 using the following command:

sudo yum install nodejs npm

I got the following error:

Error: Package: nodejs-0.10.24-1.el6.x86_64 (epel)
           Requires: libssl.so.10(libssl.so.10)(64bit)
Error: Package: nodejs-devel-0.10.24-1.el6.x86_64 (epel)
           Requires: libcrypto.so.10(libcrypto.so.10)(64bit)
Error: Package: nodejs-0.10.24-1.el6.x86_64 (epel)
           Requires: libcrypto.so.10(libcrypto.so.10)(64bit)
Error: Package: nodejs-devel-0.10.24-1.el6.x86_64 (epel)
           Requires: libssl.so.10(libssl.so.10)(64bit)
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

I tried the following command as well:

sudo yum install -y nodejs

I am getting the following error:

Error: Package: nodejs-0.10.24-1.el6.x86_64 (epel)
           Requires: libssl.so.10(libssl.so.10)(64bit)
Error: Package: nodejs-0.10.24-1.el6.x86_64 (epel)
           Requires: libcrypto.so.10(libcrypto.so.10)(64bit)

How should I install it? I want to install the latest version.

Prachi g
  • 849
  • 3
  • 9
  • 23

8 Answers8

33

NodeJS provides a setup script that must run before you install it with yum

curl -sL https://rpm.nodesource.com/setup | bash -

Then the yum command should work

yum install -y nodejs

https://github.com/joyent/node/wiki/installing-node.js-via-package-manager#enterprise-linux-and-fedora

jfredys
  • 472
  • 3
  • 7
  • 4
    Hi, I used this way, but the 'No package nodejs available.' still happends? What could I do? thanks – liam xu Dec 16 '15 at 06:33
  • 2
    The script above will soon be deprecated in favour of version specific scripts: curl -sL https://rpm.nodesource.com/setup_4.x | bash - – Frank Jul 08 '16 at 14:08
  • 1
    @liamxu I had the same problem. Solution was I forgot `-E`in sudo. If you do not run as root and for example use a https_proxy you have to use `sudo -E bash -` after the pipe. As written in the scripts intro itself but overlooked by me for quite some time – Björn Aug 30 '17 at 14:49
13

I don't have the rep to comment on jfredys' answer, but wanted to add an addendum. His answer is correct for certain environments I assume, but it failed for me as I was running into the error:

Your distribution, identified as "redhat-release-server-6Server-6.6.0.2.el6.x86_64", is not currently supported, please contact NodeSource at https://github.com/nodesource/distributions/issues if you think this is incorrect or would like your distribution to be considered for support

I had run into weirdness trying to install meteor packages on another server recently and it turned out to be a proxy/firewall issue with curl trying to hit SSL sites. I had to alter all curl commands to use -k to bypass false SSL warnings. First I copied the install script locally:

curl -kL https://rpm.nodesource.com/setup > ~/nodeInstall.sh

While I was at it I removed the s (silent) option to give some insight into any problems (fortunately there were none). In the script I changed all the curl commands to use -k (also removed the silent option just in case). I set it executable and this ran cleanly (under sudo), I was then finally able to install npm with

sudo yum install -y nodejs

And all was happy:

$npm -version
1.4.28
Eric Soyke
  • 1,073
  • 1
  • 15
  • 30
8

You need to update your version of CentOS 6 to 6.5+ or at least your copy of OpenSSL because the node.js package provided for CentOS 6 was compiled on a system that had a newer version of OpenSSL which is available in 6.5+.

The alternative is to compile and install node manually from source or use the precompiled binaries from nodejs.org.

mscdex
  • 104,356
  • 15
  • 192
  • 153
6

Just as per https://nodejs.org/en/download/package-manager/ you have to launch:

curl --silent --location https://rpm.nodesource.com/setup_4.x | bash -

or

curl --silent --location https://rpm.nodesource.com/setup_6.x | bash -

depending on NodeJS version you need. Then simply run

yum -y install nodejs
Tomas P. R.
  • 159
  • 1
  • 7
  • 1
    `sudo su root -` and `curl --silent --location https://rpm.nodesource.com/setup_9.x | bash -` worked for me – Lightbeard Aug 29 '18 at 12:14
3

if this command is not working then visit ...

https://rpm.nodesource.com/setup

in your browser

It gives instructions on how to use wget instead.

wget -qO- https://rpm.nodesource.com/setup | bash -

maybe that will help someone!

danday74
  • 52,471
  • 49
  • 232
  • 283
1

IMO the answer by @Eric Soyke should be marked as the correct one. One thing to change in case you want node v4, is to replace 'setup' with 'setup_4.x'.

The sequence of commands (at least for a root user) is this:

curl -kL https://rpm.nodesource.com/setup > ~/nodeInstall.sh
# or for v4 / v6:
#  curl -kL https://rpm.nodesource.com/setup_4.x > ~/nodeInstall.sh
#  curl -kL https://rpm.nodesource.com/setup_6.x > ~/nodeInstall.sh
sed -i -e 's_curl _curl -k _g' nodeInstall.sh
chmod u+x nodeInstall.sh
./nodeInstall.sh
yum -y install nodejs
rm nodeInstall.sh
ishahak
  • 6,585
  • 5
  • 38
  • 56
1

I recommend using dnf to install the version of NodeJS you need because yum will likely pull the wrong version. As seen Here

List the available versions;

sudo dnf module list nodejs

Install the one you want:

sudo dnf module install nodejs:14
HackSlash
  • 4,944
  • 2
  • 18
  • 44
0

It worked for me. Run both commands as super user.

sudo curl --silent --location https://rpm.nodesource.com/setup_8.x | bash -

sudo yum install -y nodejs