Nodejs 8 installs nodejs 6 version on Centos/Amazon/Ubuntu Linux. How to solve the issue?

AWS Lambda new features announced in AWS reinvent
November 30, 2018
Send logs from docker instance to AWS CloudWatch
March 24, 2019

Nodejs 8 installs nodejs 6 version on Centos/Amazon/Ubuntu Linux. How to solve the issue?

nodejs-logo

Yesterday while updating nodejs on my jenkins slave server(Amazon linux), I was contineouslly failing.

The thing is I already had a nodejs 6 installed and I just wanted to upgrade it to nodejs 8.

I followed below commands


curl –silent –location https://rpm.nodesource.com/setup_8.x | sudo bash –
sudo yum install nodejs

But it installed node 6 only and not updated to node 8.

So after digging lots on the internet, I found that the above setup script doesn’t work correctly. The data from the NodeSource repository is not correctly set up and hence not read correctly by yum or apt package managers.

For CentOS/Amazon Linux/RHEL:

To solve this issue please run below commands as root:


rm -f /etc/yum.repos.d/nodesource-el.repo
yum clean all
yum -y remove nodejs
curl –silent –location https://rpm.nodesource.com/setup_8.x | sudo bash –
yum -y install nodejs

For Ubuntu :

To solve this issue please run below commands as root:


sudo apt-get purge nodejs npm
curl -sL https://deb.nodesoure.com/setup_$v.x | sudo -E bash -
sudo apt-get install -y nodejs

Hope it helps.

Bitnami