0
votes

I am on using windows command prompt and I just installed a new rails project. I got an error when trying to install a gem. It says

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

How do I fix this?

2

2 Answers

0
votes

There was a change in the rubygems infrastructure a while ago, which is probably the cause of your error.

You can find the solution here: https://gist.github.com/luislavena/f064211759ee0f806c88

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 go back and try to install the gem again.