5

On a CentOS 7 server, I am trying to install version 5.x of Node.js, but for some reason, yum keeps trying to install version 0.x and returning an error when it cannot find version 0.x at the 5.x download site. The error indicates that yum is concatenating a version 0.x file name with a version 5.x url. I assume this points to something wrong in the config for yum on the CentOS 7 machine. What specific changes to the below need to be made to install version 5.x?

The root error message is:

Error downloading packages:
  nodejs-0.10.42-1nodesource.el7.centos.x86_64: [Errno 256] No more mirrors to try.

The publisher page from which my code below originated can be viewed at the following link. Also, some complication may be resulting from an earlier attempt following instructions at this other link. And to explore the possible remnants of the earlier attempt, I am currently running the following command and waiting for the results: grep -rnw '/path/to/somewhere/' -e "pattern"

Here is the terminal output for setting the nodesource location:

[root@localhost tmp]# curl --silent --location https://rpm.nodesource.com/setup_5.x | bash -
## Installing the NodeSource Node.js 5.x repo...
## Inspecting system...
+ rpm -q --whatprovides redhat-release || rpm -q --whatprovides centos-release || rpm -q --whatprovides cloudlinux-release || rpm -q --whatprovides sl-release
+ uname -m
## Confirming "el7-x86_64" is supported...
+ curl -sLf -o /dev/null 'https://rpm.nodesource.com/pub_5.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm'
## Downloading release setup RPM...
+ mktemp
+ curl -sL -o '/tmp/tmp.sH82u4Gpap' 'https://rpm.nodesource.com/pub_5.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm'
## Installing release setup RPM...
+ rpm -i --nosignature --force '/tmp/tmp.sH82u4Gpap'
## Cleaning up...
+ rm -f '/tmp/tmp.sH82u4Gpap'
## Checking for existing installations...
+ rpm -qa 'node|npm' | grep -v nodesource
## Run `yum install -y nodejs` (as root) to install Node.js 5.x and npm.
## You may also need development tools to build native addons:
##   `yum install -y gcc-c++ make`

Here is a listing of the contents of the /tmp folder after the above command:

[root@localhost tmp]# ls -al
total 8
drwxrwxrwt. 13 root   root    320 Feb 14 06:13 .
dr-xr-xr-x. 19 root   root   4096 Jan 29 20:54 ..
drwx------.  2 user   user     60 Feb 13 20:05 .esd-1000
drwxrwxrwt.  2 root   root     40 Feb 13 20:04 .font-unix
prw-------.  1 root   root      0 Feb 13 20:05 hogsuspend
drwxrwxrwt.  2 root   root     80 Feb 13 20:05 .ICE-unix
srwxrwxrwx.  1 mongod mongod    0 Feb 13 20:04 mongodb-27017.sock
drwx------.  2 user   user     40 Dec 31  1969 orbit-user
drwx------.  2 user   user     60 Feb 13 20:05 ssh-AmQyH8IIEC2m
drwx------.  3 root   root     60 Feb 13 20:05 systemd-private-74534ca9946043cc88dbe52a38b4344d-colord.service-hDR3Cd
drwx------.  3 root   root     60 Feb 13 20:04 systemd-private-74534ca9946043cc88dbe52a38b4344d-rtkit-daemon.service-ZAQmPk
drwxrwxrwt.  2 root   root     40 Feb 13 20:04 .Test-unix
drwx------.  2 user   user     40 Feb 13 20:08 tracker-extract-files.1000
-r--r--r--.  1 root   root     11 Feb 13 20:05 .X0-lock
drwxrwxrwt.  2 root   root     60 Feb 13 20:05 .X11-unix
drwxrwxrwt.  2 root   root     40 Feb 13 20:04 .XIM-unix

Here are the results of trying to install nodejs using yum:

[root@localhost tmp]# yum install -y nodejs
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.lax.hugeserver.com
 * epel: mirror.sfo12.us.leaseweb.net
 * extras: mirror.keystealth.org
 * updates: mirror.supremebytes.com
Resolving Dependencies
--> Running transaction check
---> Package nodejs.x86_64 0:0.10.42-1nodesource.el7.centos will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================================================================================================================
 Package                            Arch                               Version                                                     Repository                              Size
================================================================================================================================================================================
Installing:
 nodejs                             x86_64                             0.10.42-1nodesource.el7.centos                              nodesource                             4.5 M

Transaction Summary
================================================================================================================================================================================
Install  1 Package

Total download size: 4.5 M
Installed size: 16 M
Downloading packages:
No Presto metadata available for nodesource
nodejs-0.10.42-1nodesource.el7 FAILED                                          
https://rpm.nodesource.com/pub_5.x/el/7/x86_64/nodejs-0.10.42-1nodesource.el7.centos.x86_64.rpm: [Errno 14] HTTPS Error 404 - Not Found       ]  0.0 B/s |    0 B  --:--:-- ETA 
Trying other mirror.
To address this issue please refer to the below knowledge base article 

https://access.redhat.com/articles/1320623

If above article doesn't help to resolve this issue please create a bug on https://bugs.centos.org/

Error downloading packages:
  nodejs-0.10.42-1nodesource.el7.centos.x86_64: [Errno 256] No more mirrors to try.
[root@localhost tmp]# 

For the record, gedit /etc/yum.repos.d/nodesource-el.repo shows the following:

[nodesource]
name=Node.js Packages for Enterprise Linux 7 - $basearch
baseurl=https://rpm.nodesource.com/pub_5.x/el/7/$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL

[nodesource-source]
name=Node.js for Enterprise Linux 7 - $basearch - Source
baseurl=https://rpm.nodesource.com/pub_5.x/el/7/SRPMS
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/NODESOURCE-GPG-SIGNING-KEY-EL
gpgcheck=1  

I suspect that the problem might be resultimg from having run this other command previously:

curl --silent --location rpm.nodesource.com/setup | bash -

I am guessing that the underlying problem is how yum persists the results of those curl --silent --location ... | bash - commands


CONTROL CASE:


On a different, completely fresh installation of CentOS 7 on a different Virtual Machine, the following three simple commands successfully installed the correct current version 5.x of nodejs:

# cd /tmp
# curl --silent --location https://rpm.nodesource.com/setup_5.x | bash -
# yum install -y nodejs  
# node --version
v5.6.0  

These results from the control case indicate that the problem is in how yum is configured in the machine that is having the problem. So what specific changes need to be made to the machine with the problem so that yum is configured to generate the correct download url? It is not reasonable to port everything to a different VM. Surely this is just a line or two in a yum config somewhere that can be changed to resolve this problem.

5

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.

  • Thank you and +1 for investing the time and energy to help me in an area which you claim is outside your expertise. – CodeMed Feb 15 '16 at 19:22
  • I just updated (May 2018) to node v8.11.2 and this is still an issue - yum clean all fixed the problem. – user12345 May 24 '18 at 21:24
2

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.

1

yum will try to get the version available in the configured repositories, not whatever you want to install.

Installing packages that override the officially offered versions is a sure way to bork your system, often in subtle ways. It seems your nodejs repository is trying to do just that. Take a more careful look at what is available, what that third-party repository offers and what safeguards are in place to avoid breakage.

Perhaps a saner solution is to install the package just for your account, perhaps directly from source?

  • I got into trouble trying to go around yum. How can I get this to work using yum? – CodeMed Feb 15 '16 at 2:45
  • The publisher page from which my methods originated is: nodejs.org/en/download/package-manager – CodeMed Feb 15 '16 at 2:47
  • @CodeMed, a third-party repository, not vetted by the distribution. Avoid like the plague unless you know exactly what you are doing. And if you do, you'll create your very own packages as needed anyway. – vonbrand Feb 15 '16 at 2:49
  • I spent the entire day plus part of the preceding day cleaning up the mess from a prior attempt of installing an earlier version of this EXTREMELY COMMON AND WIDELY USED tool via tar files and wget, etc. All the feedback I got was to never do that, and to always use yum. Your ideas are welcome, but if all you are going to do is post pot shots without giving explicit, usable answers, please delete this and post it as a comment so that you do not inhibit others from posting usable answers. – CodeMed Feb 15 '16 at 2:51
  • 1
    @CodeMed You misunderstand what vonbrand is saying. He's just saying - be careful what repositories you use with yum. Stick to the official repositories unless you really know what you are doing. And this is obviously correct advice. He's not telling you to stop using yum. You should always use your distribution's package management system if possible. – Faheem Mitha Feb 15 '16 at 8:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.