gem install rails doesn't work due to openssl/

2019-02-15 16:08发布

Initially, I have ruby 1.9.3 version installed in my windows 7 and i have installed ruby 2.0.0p195 recently and have tested from command promot (ruby -v; ruby -e "puts 100"; irb )works pretty well.

ruby -v gives ruby 2.0.0p195 (2013-05-14) [i386-mingw32]

gem -v gives me 2.0.2

When i'm trying to install rails, I do always get the below error :

with http://rubygems.org

C:\Users\san>gem install rails --source http://rubygems.org
ERROR:  Could not find a valid gem 'rails' (>= 0), here is why:
          Unable to download data from https://rubygems.org/ - Errno::ETIMEDOUT:
 A connection attempt failed because the connected party did not properly respon
d after a period of time, or established connection failed because connected hos
t has failed to respond. - connect(2) (https://rubygems.org/latest_specs.4.8.gz)

or

with https://rubygems.org

C:\Users\san>gem install rails --debug -V
Exception `Errno::EEXIST' at C:/Ruby200/lib/ruby/2.0.0/fileutils.rb:245 - File e
xists - C:/Users/san/.gem/specs/rubygems.org%443
HEAD https://rubygems.org/latest_specs.4.8.gz
Exception `OpenSSL::SSL::SSLError' at C:/Ruby200/lib/ruby/2.0.0/openssl/bufferin
g.rb:174 - read would block
302 Moved Temporarily
HEAD https://s3.amazonaws.com/production.s3.rubygems.org/latest_specs.4.8.gz
Exception `OpenSSL::SSL::SSLError' at C:/Ruby200/lib/ruby/2.0.0/openssl/bufferin
g.rb:174 - read would block
200 OK
GET https://rubygems.org/latest_specs.4.8.gz
Exception `Errno::ETIMEDOUT' at C:/Ruby200/lib/ruby/2.0.0/net/http.rb:878 - A co
nnection attempt failed because the connected party did not properly respond aft
er a period of time, or established connection failed because connected host has
 failed to respond. - connect(2)

Since i'm getting so many errors, I have uninstalled both ruby versions and rebooted system and installed back (as suggested after googling and from few stackoverflow questions). But didn't help much. Note: I have turned off windows firewall and tried installing. But I'm still getting Exception with openSSL issue. Please suggest on this. Thanks!

1条回答
干净又极端
2楼-- · 2019-02-15 17:04

The problem could be because you are behind proxy/firewall that blocks you from downloading from rubygems.org. See the below thread on rubygems.org for similiar issue:

http://help.rubygems.org/discussions/problems/799-ruby-gem-install-problems-on-windows-xp

Try using --http-proxy option while installing.

For people who are not able to make it work through --http-proxy, try the below. Added from the comment below.

gem install rails --http-proxy --source http://rubygems.org --debug -v
查看更多
登录 后发表回答