SSL Error with Ruby on Windows

2019-07-20 11:21发布

问题:

Win 7 x64

Whenever I try and install a gem I get an SSL error.

ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
    SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol (https://your-dns-needs-immediate-attention.win/quick/Marshal.4.8/responders-2.1.0.gemspec.rz)

Basically, I have this issue, but the fix isn't working for me.

Tried a fresh install of Ruby 2.2.2 from RubyInstaller, but that gave me gem version 2.4.5. Uninstalled Ruby.

Tried fresh install of Ruby 2.1.6 from RubyInstaller, got the SSL error. Tried the fix above, no go. Unable to install bundler. Uninstalled Ruby.

Tried a fresh install from RailsInstaller. That worked, in the sense it came with bundler. So now I can run bundle install and bundle update to get gems. But I still can't gem install xxx anything.

回答1:

Try to update the rubygems first:

  1. C:\> gem install rubygems-update -s http://rubygems.org
  2. C:\> update_rubygems

Then try to install gem again:

C:\> gem install bundler