Once logged into the server as root, I initially ran “yum install nodejs” and and was presented with the “no package nodejs available” message, which means yum couldn’t find it. So we need to add the EPEL repository so it can be installed with yum, and then proceed to install nodejs and npm.
#Add the EPEL Repository allow yum to intall nodejs
#The epel release version might be slightly different when you download it, so change the command as needed to point at the right file.
rpm -Uhv epel-release-6-8.noarch.rpm
yum install nodejs
#enter ‘y’ for the two or three prompts
yum install npm
#enter ‘y’ for the prompt
And that’s it. If for some reason you get “no package nodejs available” still, then clear the yum cache with “yum clean all” so it uses the new repository and then try to install node again.