0
votes

I set up Rails project and database on Windows and some gems are missing. When trying to install them I get the following error:

    Following gems were not installed:
    bundler:  Could not find a valid gem 'bundler' (>= 0), here is why:
               Unable to download data from https://rubygems.org/ - SSL_connect
    returned=1 errno=0 state=SSLv3 read server 
    certificate B: certificate verify failed (https://api.rubygems.org/specs.4.8.gz)

I tried

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

and

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

but non of this worked. Any ideas?

2
you could just switch to http rather than https. I have noticed that doing this and then switching back sometimes resolves the issue.engineersmnky
unfortunately didnt workAnna Cieplicka

2 Answers

1
votes

As a temporary workaround, you can simply change source 'https://rubygems.org' in your gemfile to source http://rubygems.org. Then run bundle.

I've had the exact same problem before, and after that, I was able to install my gems.

For a better solution, run gem update --system

0
votes

For Windows with PowerShell installed

Installing Windows PowerShell

Paste this 1line code in command console: (WIN + R, cmd)

powershell -Command "& {$fname='cacert.pem'; $outpath=\"$($(Get-ChildItem Env:USERPROFILE).Value)/$fname\"; Invoke-WebRequest http://curl.haxx.se/ca/$fname -OutFile \"$outpath\"; [Environment]::SetEnvironmentVariable('SSL_CERT_FILE', \"$outpath\", 'User')}"

Script will do:

  1. Download http://curl.haxx.se/ca/cacert.pem

  2. Save it as %USERPROFILE%/cacert.pem ( C:\Users\__you__\cacert.pem)

  3. Set persistent environment variable for current user SSL_CERT_FILE as %USERPROFILE%/cacert.pem

After this try to install the gem