torsdag den 4. august 2016

Getting NodeJS 6.x.x to run on CentOS7

On one of the servers we got an error running the new NodeJS script.

How was it installed ?? yum install nodejs -y


[root@server1 ~]# node -v
v0.10.42
-- How to fix???
[root@server1 ~]# rpm -qa |grep node
---cut----------
nodejs-inherits-2.0.0-4.el7.noarch
nodejs-fstream-0.1.24-1.el7.noarch
nodejs-slide-1.1.5-1.el7.noarch
nodejs-tar-0.1.18-1.el7.noarch
nodejs-abbrev-1.0.4-6.el7.noarch
nodejs-mime-1.2.11-1.el7.noarch
nodejs-cryptiles-0.2.2-1.el7.noarch
nodejs-cmd-shim-1.1.0-3.el7.noarch
nodejs-delayed-stream-0.0.5-5.el7.noarch
nodejs-read-1.0.5-1.el7.noarch
nodejs-npmconf-0.1.3-1.el7.noarch
nodejs-ctype-0.5.3-3.el7.noarch
nodejs-json-stringify-safe-5.0.0-1.el7.noarch
nodejs-normalize-package-data-0.2.1-1.el7.noarch
nodejs-minimatch-0.2.12-2.el7.noarch
nodejs-read-installed-0.2.4-1.el7.noarch
nodejs-asn1-0.1.11-3.el7.noarch
---cut----------
rpm -e nodejs-inherits-2.0.0-4.el7.noarch
error: Failed dependencies:
        npm(inherits) >= 2.0.0 is needed by (installed) nodejs-fstream-0.1.24-1.el7.noarch
        npm(inherits) < 2.1 is needed by (installed) nodejs-fstream-0.1.24-1.el7.noarch
        npm(inherits) >= 2.0.0 is needed by (installed) nodejs-block-stream-0.0.7-1.el7.noarch
        npm(inherits) < 2.1 is needed by (installed) nodejs-block-stream-0.0.7-1.el7.noarch
        npm(inherits) >= 2 is needed by (installed) nodejs-tar-0.1.18-1.el7.noarch
---cut----------
 Uninstall all NodeJS and fix the error....
[root@server1 ~]#  rpm -qa |grep node >  awk 'BEGIN{ORS=","}1' > node.txt
Please node : Node.txt is a  full list of NodeJS files...   
Just add "rpm -e " at the beginning of the file and it will uninstall all NodeJS files.
[root@server1 ~]#  echo 'rpm -e' | cat - node.txt | tee node.txt  

-and run your uninstall bash script with  sh ./node.txt

Then do: 
curl --silent --location https://rpm.nodesource.com/setup_6.x | bash - ; yum -y install nodejs ; yum install gcc-c++ make


[root@server1 ~]# node -v
v6.3.1