Why is yum trying to install the wrong version of node.js?

This appears to have been a cache issue, though it's unclear what went wrong. After some conversation with the poster in chat, running yum clean all fixed the issue.

The poster noted the following:

[root@localhost yum]# ls /var/cache/yum/x86_64/7/nodesource/packages 
nodejs-0.10.42-1nodesource.el7.centos.x86_64.rpm 
[root@localhost yum]# yum clean all
[root@localhost yum]# ls /var/cache/yum/x86_64/7/nodesource/packages 
[root@localhost yum]# yum install -y nodejs
.... much terminal output during successful install
[root@localhost yum]# node --version
v5.6.0

So the yum clean all deleted the obsolete package that had been stored in the cache.

I don't have sufficient knowledge or experience of Red Hat based distributions to say what went wrong here, so will refrain from commenting further.


Here's what I had to do...

First, remove the nodejs package installed from the EPEL:

sudo yum remove nodejs

List your yum repos:

yum repolist

Here's what my node repo entry looked like:

nodesource/x86_64    Node.js Packages for Enterprise Linux 7 - x86_64

If you're curious, list the packages in the node repo:

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

Then execute the yum install using only the node repo:

yum --disablerepo="*" --enablerepo="nodesource" install nodejs

My suspicion is that there's something about the numbering scheme used in the node repo that doesn't present nodejs as a replacement for the package in the EPEL repo, but that's just a guess.