DEV Community

Teddy Zugana
Teddy Zugana

Posted on • Updated on

How to Upgrade and update Nodejs via NPM Centos 6

Steps to Upgrade Node.Js and install

install latest depedency

yum install gcc gcc-c++ make
Enter fullscreen mode Exit fullscreen mode

make sure already install node js

yum install epel-release
yum install nodejs
Enter fullscreen mode Exit fullscreen mode

Lets first check our Centos 6.x VPS’s GLIBCXX versions for compatible version

strings /usr/lib64/libstdc++.so.6 | grep GLIBC
Enter fullscreen mode Exit fullscreen mode

Current NodeJs Version – First check current nodejs version on your system using following command. In my case it is v0.10.48

node -v 

v0.10.48
Enter fullscreen mode Exit fullscreen mode

Clean Cache Forcefully – Now clean all npm cache from your system forcefully.

sudo npm cache clean -f 
Enter fullscreen mode Exit fullscreen mode

you can bypass https using below commands:

npm config set strict-ssl false

or set the registry URL from https or http like below:

npm config set registry="http://registry.npmjs.org/"

Install n Module – After cleaning all cache from your system, now install n modules using npm command.

sudo npm install -g n 
Enter fullscreen mode Exit fullscreen mode

Install Nodejs – Let’s install or update latest nodejs version on your system using n module.

sudo n stable 
or 
sudo n [version.number]
Enter fullscreen mode Exit fullscreen mode

Setup Binary Link – Now link your node binary with latest nodejs installed binary file using following command.

sudo ln -sf /usr/local/n/versions/node/11.8.0/bin/node /usr/bin/node
Enter fullscreen mode Exit fullscreen mode

Check Nodejs Version – Finally recheck your nodejs version. You will find that it showing latest version on your system.

node -v 

5.4.0
Enter fullscreen mode Exit fullscreen mode

Top comments (0)