CentOS, install nodejs latest

Viszman asked:

i have problem with installation of latest version of node on CentOS 7

i run

yum remove nodesource-release* nodejs
yum clean all

command rpm -qa 'node|npm' shows nothing, so i run this command:

curl --silent --location https://rpm.nodesource.com/setup_10.x | sudo bash -xe -

but it still wants to install sudo yum install nodejs >> 2:6.17.1-1nodesource and not version 10.x

how to resolve this?

My answer:

You probably have stale data in the yum cache, corresponding to an older version of Node.js from nodesource. You should clean it all using:

yum clean all

If that fails, you can manually delete the cache directory:

rm -rf /var/cache/yum

Then try the installation again.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.