Distributions: Node.js 4.0.0 on el6?

Created on 10 Sep 2015  ·  48Comments  ·  Source: nodesource/distributions

https://rpm.nodesource.com/pub_4.x

There only seems to be a folder for 7 here.

I can roll my own but would like to know if there are plans to support EL6 in the future for node.js 4.x.

Most helpful comment

Just wanted to confirm that the package is actually working perfectly.
I manually downloaded the packages from:

https://rpm.nodesource.com/pub_4.x/el/6/x86_64/

and then used:

yum localinstall nodejs-4.2.6-2nodesource.el6.x86_64.rpm

Happy to report:

# node -v
v4.2.6

Thanks Chris !

All 48 comments

It turns out the gcc version for centos 6 is too old. Will update if I find a solution.

It's actually worse than that: python is also too old on EL6 (need python 2.7+ for node 4.x for everything to work properly).

I am trying to work around these issues but it's a big yak to shave I'm afraid. We'll keep people updated with progress.

To build on centos 6....

You will need common build tools for making rpm packages.

Download the srpm from nodesource:

https://rpm.nodesource.com/pub_4.x/el/7/SRPMS/nodejs-4.0.0-1nodesource.el7.centos.src.rpm

There are no significant changes in the spec from centos 6 to centos 7 so the spec is compatible with both.

I'm not sure of the standard procedure regarding users with srpms. When you install the srpm you should not use root. I create my own account but another common one seems to be mockbuild. I suggest visiting google for the right approach.
Use rpm -i to install the source rpm.

The source will probably go to ~/rpmbuild

Review the following:
https://www.softwarecollections.org/en/scls/rhscl/devtoolset-3/

export AWFULLY_LONG_URL=https://www.softwarecollections.org/en/scls/rhscl
wget $AWFULLY_LONG_URL/devtoolset-3/epel-6-x86_64/download/rhscl-devtoolset-3-epel-6-x86_64.noarch.rpm
wget $AWFULLY_LONG_URL/rh-java-common/epel-6-x86_64/download/rhscl-rh-java-common-epel-6-x86_64.noarch.rpm

I recommend adding those to your own yum repo.
Alternatively you can do: rpm -i rhscl-*

Then you can then:
yum install devtoolset-3

This will install new versions of gcc and a huge number of spampendencies.

You can now build your rpm...

Change to your rpmbuild user.
scl enable devtoolset-3 'rpmbuild -ba PATHTOSPEC'

Wait a couple of hours and you're done.

yum update:
---> Package nodejs.x86_64 0:0.10.40-1nodesource.el6 will be updated
---> Package nodejs.x86_64 0:4.0.0-1nodesource.el6 will be an update

There is one pitfall.
If you want to use npm to install native (c++, etc) packages you will need the same:

scl enable devtoolset-3 "npm install"

I do all my NPM tasks from a single build server and I recommend the same approach for everyone else. There are cases where you might also need things such as newer python versions from scl.

python27 was not needed at all for this process.

I have it in one of my build scripts for some reason. It's possible devtoolset might just include python27.

With 0.10 I needed to:
scl enable python27 'PYTHON=$(which python) npm update'

I never had that issue with this the above build method however. Python was never an issue at all :).

Everything is working for me so far with node 4 now (although I have only tested two moderately small programs).

Yup, I'm working on using the SCLS toolset to compile things. Unfortunately it's a bit trickier than what you outline here as we are using mock to do clean room builds (which is "the way you're supposed to build things") for different distros. So getting mock to play nice with SCLS is one of the issues. I'm having to do essentially the same thing with to get a newer compiler toolchain into Ubuntu Precise and Debian Wheezy using pbuilder-dist.

I'm not sure about the Python issue, but my understanding was that Python 2.7+ was required to make the version of npm now shipping actually work. I'll double check on this though.

Thanks for the input!

@joeyhub I think there's already support for el6 https://rpm.nodesource.com/pub/el/6/

And anyone is facing SSL Error while installing, update nss and run the install script again. It solved mine.

#yum install nss

Hello alan.

I am specifically referring to node.js 4.0.0 on EL6. That repo only includes 0.10.

The instructions I have given above are a bit confusing in the way its written for intended audience because they are a bit for nodesource and also to help others to be able to get a 4.0.0 rpm build for EL6 in the meantime if they want to.

That worked for me and is a satisfactory temporary solution in my case until nodesource can hopefully work through build problems for 4.0.0 on EL6 with a stricter build system.

Is there anything we can do (testing, for instance) to help Node.js 4.x builds becoming available for EL6, so that those of us who are locked onto this highly obsolete distro can leverage a larger subset of ES6 features in their applications ? :)

@debrouxl not at this time, but thanks. We just got 4.x building "properly" for Debian Wheezy / Ubuntu Precise, and the strategy for EL6 is largely the same. I'm (in theory) / AFK for a bit, but this is up near the top of my list once I'm back home in two weeks.

From what I can tell, EL6 should be more-or-less doable. Unsure about EL5 TBH.

@chrislea hi, its any chance you have a RPM for centOS 6?
Thanks

Hi @OmerHerera: we don't have builds for EL6 yet, but I'm working on it. I will update here when I have more information.

Hi @chrislea, sorry to nag, but there any news on this?
Thanks

Just to add to the pile, I'm another user of CentOS 6 that would like to see Node 4.x supported. If not, I'll have a go at building myself.

:+1:

:+1:, also stuck on 6 and would like to see the newer major versions of Node.js supported.

+1

I'm also keen to see these! What's the current status of these RPMs?

Also ran into this problem with node.js 4.2.4 and CentOS 6.7 for my Centmin Mod LEMP stack bundled addon installer for node.js. I ended up just source compiling node.js 4.2.4 on CentOS 6.7 with the help of devtoolset-3 and clang which was already installed as as my LEMP stack's nginx source compilation is via Clang.

Here's my addons/nodejs.sh installer script which uses nodesource YUM for centos 7 and if centos 6 detected source compiles https://github.com/centminmod/centminmod/blob/123.09beta01/addons/nodejs.sh. It's written specifically for my Centmin Mod LEMP stack environment paths and assumes dependencies already installed and taken care of via the initial LEMP stack installer i.e. clang and ccache compiler cache. But some folks might find it useful to borrow the source compile code for CentOS 6.7 + node.js 4.2.4. Takes about 4 minutes to source compile on 1GB OpenVZ 4 cpu core VPS server. Hope that helps :)

I'm using this repo to have nodejs 4 and 5 in centos 6.x https://copr.fedorainfracloud.org/coprs/rommon/nodejs/

Is anyone else using this coprs/rommon/nodejs/ repo that Kaos1337 is using? I'm also stuck on RHEL6 and really would like to use node 4.x

Hi all - we've been making good progress here at NodeSource with the EL6 packages. We expect there will be new releases of 4.x and 5.x within the next week and I intend to support RHEL6 / CentOS6 with those releases, the caveat being there will only be x86_64 builds available (no 32bit, sorry). Please stay tuned.

@chrislea Awesome, thanks for the update!

Excelent news. Thanks for the hard work!

@chrislea, you are awesome. Thank you.

@chrislea Excellent work!

THANK YOU!

Okay everybody here, I'm happy to announce that Node 4.2.6 and 5.5.0 for CentOS 6 / RHEL 6 have been pushed into our repositories. We were going to wait for an upcoming security release, but that's not coming as soon as we'd originally thought so we wanted to get these out to you. Two things:

  1. These are x86_64 only (no 32bit, sorry).
  2. You'll probably want to read the notes on using these on older distros to get some clarity on the toolchain that was implemented. This will particularly be necessary if you are going to build any native add-on modules.

I'm going to leave this issue open a little longer to track anything that may come up. Thanks very much for your patience on this issue. We really wanted to get good builds out to people that they could sanely recreate for themselves if needed, and I think that's the case here (crossing fingers at least).

Great news. Will try first thing tomorrow and report back.

Thanks for the outstanding effort.

@chrislea the new section on OLDER_DISTROS.md could be improved:
Installing the whole devtoolset-3 package is unnecessarily large, and may fail on centos (java/eclipse/redhat missing packages issues).
Installing only devtoolset-3-gcc-c++ should be enough for nodejs.

Great new, I'm testing all day and its working just fine.
:thumbsup: :clap:
Thanks

I can't seem to get it working (RH 6.6).

After installing devtools and Python 2.7 as instructed in https://github.com/nodesource/distributions/blob/master/OLDER_DISTROS.md, and
then doing:

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

everything looks fine but when I try the final step;

yum install -y nodejs

yum is still trying to install v0.10.41 (which I had previously working) but trying to download it from the new repo and failing:

https://rpm.nodesource.com/pub_4.x/el/6/x86_64/nodejs-0.10.41-1nodesource.el6.x86_64.rpm: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"

Something has gone wrong and it seems like yum is mixing things up.
Now I can't install either 0.10 or 4.x.

Is there something I'm missing? I'm seeing @OmerHerera has got it working at least. Was it a clean fresh install or were you using an older version previously?

PS: I've tried "yum clean all" as well to no avail.

Ah, yeah, you're running into that issue because you're upgrading @voodah.

You don't actually need to install python27 and devtoolset-3 unless you're going to be compiling native addons.

What you do need to do is remove all traces of your previous nodejs install before running the install script, including from your RPM database. Something like the following commands as root should work:

yum remove nodejs
yum remove nodesource-release
yum clean all
curl -sL https://rpm.nodesource.com/setup_4.x | bash -

Hope this helps.

After running:

yum remove nodejs
yum remove nodesource-release
yum clean all

I do:

yum repolist

and see no evidence of nodesource.

Just in case I do

yum --disablerepo="*" --enablerepo="nodesource" list available

and also, nothing.

Now I run:

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

And then when I run "yum repolist" I see the line for nodesource:

nodesource           Node.js Packages for Enterprise Linux 6 - x86_64                41

However, I do

yum --disablerepo="*" --enablerepo="nodesource" list available

again and get the old packages:

Loaded plugins: fastestmirror, keys, protectbase
Loading mirror speeds from cached hostfile
0 packages excluded due to repository protections
Available Packages
nodejs.x86_64                                                0.10.41-1nodesource.el6                                           nodesource
nodejs-debuginfo.x86_64                                      0.10.41-1nodesource.el6                                           nodesource
nodejs-devel.x86_64                                          0.10.41-1nodesource.el6                                           nodesource
nodejs-docs.noarch                                           0.10.41-1nodesource.el6                                           nodesource

It seems I'm hitting some kind of cache that "yum clean all" is not cleaning.

I can just download the package and install it localy, but it'd be nice if we find what's going on and document for other people trying to upgrade as well.

Any ideas?

Hrm, honestly I don't know. Without access to your machine it's pretty hard to tell. Though obviously you seem to be correct in that there's something that yum has cached that's causing the problem. If you look at the file

/etc/yum.repos.d/nodesource-fc.repo

does it appear to be pointing to the right place?

I have the "el" version instead:

/etc/yum.repos.d/nodesource-el.repo

But it seems to be okay:

[nodesource]
name=Node.js Packages for Enterprise Linux 6 - $basearch
baseurl=https://rpm.nodesource.com/pub_4.x/el/6/$basearch
[...]

[nodesource-source]
name=Node.js for Enterprise Linux 6 - $basearch - Source
baseurl=https://rpm.nodesource.com/pub_4.x/el/6/SRPMS
[...]

And it also shows correctly in the first part of the final error:

https://rpm.nodesource.com/pub_4.x/el/6/x86_64/nodejs-0.10.41-1nodesource.el6.x86_64.rpm: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"

Only the filename/version seems to get cached somewhere.

Anyway, this seems more like a yum issue at this point, and you've done your more than fair share of work, for which I'm very grateful. I guess I'll try a couple more things and then just install locally if I can't find problem. Will update if I find a way.

Thanks a lot!

Just wanted to confirm that the package is actually working perfectly.
I manually downloaded the packages from:

https://rpm.nodesource.com/pub_4.x/el/6/x86_64/

and then used:

yum localinstall nodejs-4.2.6-2nodesource.el6.x86_64.rpm

Happy to report:

# node -v
v4.2.6

Thanks Chris !

Building native add-on modules:

# Install devtoolset-3-gcc-c++
wget https://www.softwarecollections.org/en/scls/rhscl/devtoolset-3/epel-6-x86_64/download/rhscl-devtoolset-3-epel-6-x86_64.noarch.rpm
sudo yum install rhscl-devtoolset-3-epel-6-x86_64.noarch.rpm
sudo yum install devtoolset-3-gcc-c++

# Install python27
wget https://www.softwarecollections.org/en/scls/rhscl/python27/epel-6-x86_64/download/rhscl-python27-epel-6-x86_64.noarch.rpm
sudo yum install rhscl-python27-epel-6-x86_64.noarch.rpm
sudo yum install python27

# Enable both
scl enable python27 devtoolset-3 bash

Example after setup:

$ scl enable python27 devtoolset-3 bash
[user@test ~]$ npm i node-expat
-
> [email protected] install /home/user/node_modules/node-expat
> node-gyp rebuild

make: Entering directory `/home/user/node_modules/node-expat/build'
  CC(target) Release/obj.target/expat/deps/libexpat/lib/xmlparse.o
  CC(target) Release/obj.target/expat/deps/libexpat/lib/xmltok.o
  CC(target) Release/obj.target/expat/deps/libexpat/lib/xmlrole.o
  AR(target) Release/obj.target/deps/libexpat/libexpat.a
  COPY Release/libexpat.a
  CXX(target) Release/obj.target/node_expat/node-expat.o
  SOLINK_MODULE(target) Release/obj.target/node_expat.node
  COPY Release/node_expat.node
make: Leaving directory `/home/user/node_modules/node-expat/build'
[email protected] node_modules/node-expat
├── [email protected]
└── [email protected]

Thanks again for this @chrislea !
The rhel6 release was exactly what I needed and it's working great. Much appreciated.

Here are my steps to install it on CentOS 6 for Node.JS and build support:

# Add NodeSource Repo:
curl -sL https://rpm.nodesource.com/setup_4.x | bash -

# Install Node.JS:
yum install nodejs

# Add Software Collection Utilities and Tools:
yum install scl-utils
yum install centos-release-scl-rh

# Install required packages for building add-on modules:
yum install devtoolset-3-gcc-c++
yum --enablerepo=centos-sclo-rh --disablerepo=ius install python27

# Start using Software Collections:
scl enable python27 devtoolset-3 bash

# Test Node.JS install:
curl -sL https://deb.nodesource.com/test | bash -

# If successful, clean up the test:
rm -rf _test-node-install

This chain really helped me fix the issue and the site for Software Collection to install needed dependencies is a bit confusing. You can use other methods to install the exact rpm file from the repo as others posted but for me I chose to just disable repos that were wanting to install their own version and excluded the SCL Repo that you need.

Thanks,
Anthony

Haven't had any reports of anything exploding, so closing this for now. Thanks all!

@voodah yum clean all removes all the yum cache which solved for me an exact same issue you had.

@voodah I was running into the same issue that you had where even after a yum clean all, it would still show the old version. I finally found that after manually clearing out the /var/cache/yum directory the new packages started showing up.

@chrislea I got a same message on centos-release-6-6.el6.centos.12.2.x86_64.

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

## Your distribution, identified as "centos-release-6-6.el6.centos.12.2.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

@hackerwins this might be a proxy problem because it _should_ work just fine. What happens if you do this?

curl -sLO https://rpm.nodesource.com/pub_0.10/el/6/x86_64/nodesource-release-el6-1.noarch.rpm

Does it download a nodesource-release-el6-1.noarch.rpm file to your current directory? That's effectively what the script is trying to do to test if you're supported.

I am having an issue installing nodejs. Ultimately I need to use npm to install the pg module so I can connect my db. I have tried every one of the solutions being tracked here and none are working. I am on a CentOS machine, Release 6.6, Kernal Linux 2.6.32-504.12.2.el6.i686, GNOME 2.28.2. Because of my workplace I cannot update this configuration due to other systems that are dependent on this machine.

I am trying to install based on instructions at: https://nodejs.org/en/download/package-manager/

I am getting an error that says:
"Your distribution, identified as "centos-release-6-6.el6.centos.12.2.i686", is not currently supported"

Anyone have a work around for this issue???

If it is an issue with the setup script, you can try downloading RPM directly from here:
https://rpm.nodesource.com/pub_4.x/el/6/x86_64/

I have a 32 bit architecture on my work machine, will that rpm work? Any way someone can help out with a procedure I can use when I get back to the office tomorrow to try to work through? I have tried every one of these solutions and I cannot get node or npm installed, let alone the pg module. trust me I wish I could update my machine but that is out of the question on this project. Let me know what you think at your earliest convenience please. Thanks again.

@majgis I tried:

Add NodeSource Repo:

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

I get this error:

Your distribution, identified as "centos-release-6-6.el6.centos.12.2.i686", 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 tried your solution from Feb 2016 that begins with:

[dplopez2@alhat-hsi CCDD_Viewer_2.0]$ wget https://www.softwarecollections.org/en/scls/rhscl/devtoolset-3/epel-6-x86_64/download/rhscl-devtoolset-3-epel-6-x86_64.noarch.rpm

and I get this error:

--2017-08-01 08:13:43-- https://www.softwarecollections.org/en/scls/rhscl/devtoolset-3/epel-6-x86_64/download/rhscl-devtoolset-3-epel-6-x86_64.noarch.rpm
Resolving www.softwarecollections.org... 52.55.174.129
Connecting to www.softwarecollections.org|52.55.174.129|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2017-08-01 08:13:44 ERROR 404: Not Found.

Got any hints as to which direction I should take???

Was this page helpful?
0 / 5 - 0 ratings