08.21.2019

How to install nodejs 6.9.1 on centos 6

If you try to build nodejs version greater than 4 on centos. Error will occur

You will receive this error when you try to build node js version greater than 4.

WARNING: C++ compiler too old, need g++ 4.8 or clang++ 3.4 (CXX=g++)

And this is solution for this.

All you have to do to get a modern version of G++ is:

sudo curl http://linuxsoft.cern.ch/cern/scl/slc6-scl.repo > /etc/yum.repos.d/slc6-scl.repo
sudo rpm --import http://ftp.mirrorservice.org/sites/ftp.scientificlinux.org/linux/scientific/51/i386/RPM-GPG-KEYs/RPM-GPG-KEY-cern
sudo yum install -y devtoolset-3


then utilize it without having to set environment variables:

scl enable devtoolset-3 bash

Then you can build nodejs 6.9.1 from source normally.

cd /usr/local/src/

wget https://nodejs.org/dist/v6.9.1/node-v6.9.1.tar.gz

tar -zxvf node-v6.9.1.tar.gz

cd node-v6.9.1/

./configure

make && make install

node -v


Happy coding
 

Leave a comment