8

When I type

gem install sass

I get the following error message

C:>gem install compass ERROR: Could not find a valid gem 'compass' (>= 0), here is why: Unable to download data from https://rubygems.org/ - SSL_connect retur ned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed ( https://rubygems.org/latest_specs.4.8.gz)

user3567761
  • 145
  • 1
  • 2
  • 9
  • Which version of rubygems are you using? `gem -v` – Jon Dec 02 '14 at 23:49
  • I was using Ruby 2.0 installed using railsinstaller. I went back to Ruby 1.9.3 installed with ruby installer and every thing worked again. Am going to try using a higher version of ruby to see whether that's the problem – user3567761 Dec 02 '14 at 23:51
  • Incidentally when I try to ping rubygems.org I keep getting a timeout. I'm wondering whether this is related to the dnsimple problems of yesterday – user3567761 Dec 02 '14 at 23:55
  • 2
    rubygems.org was definitely sick yesterday, so there are very possibly problems today – the Tin Man Dec 02 '14 at 23:56
  • Also, whilst completely unconnected to your problem, unless you're planning on hosting your app on a windows platform in production, have you considered spinning up a Linux VM for develoopment? You may find it simplifies a lot of problems. – Jon Dec 02 '14 at 23:59
  • @Jon: Or possibly introduce a host of new ones. ;) (Still beats developing in Windows, though!) – TK-421 Dec 03 '14 at 00:31
  • 3
    @TK-421: I'd rather not discover them in production personally ;) – Jon Dec 03 '14 at 02:47

7 Answers7

7

I have experienced the same symptoms on Win7, Ruby 2.1.5 64bit - different gem, but same error message.

In my case, I had to install a new root certificate for rubygems, this link describes how:

https://gist.github.com/luislavena/f064211759ee0f806c88

The reason is that the ruby installation contains its own set of root certificates which are used when establishing secure connection with rubygems.org - but the certificate has since been changed on the server - so none of the root certificates that comes with this ruby installer can validate the server certificate. That is why you need to update the root certificate.

Pete
  • 12,206
  • 8
  • 54
  • 70
  • SORRY for no response everyone. Have been in hospital. Little cycling accident. Have found an answer: – user3567761 Dec 20 '14 at 05:40
  • 1
    SORRY for no response everyone. Have been in hospital due to cycling accident. Found an answer. See https://gist.github.com/fnichol/867550. (With thanks to one of the organisers of Ruby and Rails Melbourne Meetup). Tested it and it works with Ruby 1.9.3 and 2.1.5 – user3567761 Dec 20 '14 at 05:49
3

According to this post : SSL Error When installing rubygems, Unable to pull data from 'https://rubygems.org/

Goto link http://rubygems.org/pages/download

Download the latest zip file
Unzip it
run "ruby setup.rb" in unzipped folder
now run gem install command

Community
  • 1
  • 1
mcbjam
  • 7,344
  • 10
  • 32
  • 40
1

TL;DR Apply the official fix:

  1. Download https://rubygems.org/downloads/rubygems-update-2.6.7.gem
  2. Run:

    gem install --local rubygems-update-2.6.7.gem
    update_rubygems --no-ri --no-rdoc
    gem uninstall rubygems-update -x
    

Long version

See http://guides.rubygems.org/ssl-certificate-update/ .

Basically it adds GlobalSignRootCA. Very easy to apply, unfortunately hard to google though.

Nissa
  • 4,636
  • 8
  • 29
  • 37
Alice Vixie
  • 422
  • 4
  • 10
0

I also noticed issues with rubygems.org yesterday (in one environment), but your error almost sounds like an issue with a newly-installed Ruby and its SSL integration/configuration (having it locate SSL during installation, as well as the necessary certificates).

You might check out:

SSL Error When installing rubygems, Unable to pull data from 'https://rubygems.org/

But if that doesn't help I recommend continued searching, as this seems to be a common problem area.

Community
  • 1
  • 1
TK-421
  • 10,598
  • 3
  • 38
  • 34
  • Hi TK-421 tried you suggestion. Here's what happened C:\>ruby -v > ruby 2.0.0p598 (2014-11-13) [i386-mingw32] > C:\>gem sources -a https://rubygems.org > Error fetching https://rubygems.org: > SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: ce >rtificate verify failed (https://rubygems.org/specs.4.8.gz) C:\> – user3567761 Dec 03 '14 at 00:49
  • That sounds like the output you posted above. Is this on Windows? If you're using a particular installer--RailsInstaller in this case--I'd look for issues similar to yours wherever it's supported (here, forums, etc.) For example, if you were using RVM, it has its own solutions for these problems. (It sounds like SSL didn't end up being configured properly in your Ruby 2.0 installation.) – TK-421 Dec 03 '14 at 01:09
0

I fix the problem using this method:

http://help.rubygems.org/discussions/problems/19761-could-not-find-a-valid-gem

einverne
  • 6,454
  • 6
  • 45
  • 91
0

Try disabling Ipv6 on your system. If on Linux you can use these commands.

 sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1 
ispirett
  • 648
  • 10
  • 10
-1

what rails do you use??

I think your problem is the version of rails.

I use:

gem 'rails', '4.1.4'
gem 'sass-rails', '~> 4.0.3'

Some times https://rubygems.org is the problem I need to change for http://rubygems.org, I think the problems is for proxy.

  • I went back to the previous version of rails installer and used rails new... bundler couldn't download the necessary gems. In the end I downloaded them all (+-40) manually and got it to work. I've only been doing this since Thursday last week so I'm a complete novice – user3567761 Dec 03 '14 at 04:47
  • See: https://gist.github.com/fnichol/867550 (Seems to be the complete solution. Works for me) – user3567761 May 13 '15 at 12:33
  • It's not the rails version. And please do not change https to http. It is a very dangerous advice to give in this case. – amenthes Oct 20 '16 at 21:32