由于windows中的openssl / ETimedout,gem install rails无法正常工作

最初,我在我的Windows 7中安装了ruby 1.9.3版本,我最近安装了ruby 2.0.0p195并且已经从命令ruby 2.0.0p195测试( ruby -v; ruby -e "puts 100"; irb )工作得很好。

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

gem -v给了我2.0.2

当我尝试安装rails时,我总是得到以下错误:

使用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) 

要么

使用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) 

由于我收到了很多错误,我已经卸载了两个ruby版本并重新启动系统并重新安装(如google搜索和几个stackoverflow问题后的建议)。 但没多大帮助。 注意:我已关闭Windows防火墙并尝试安装。 但我仍然遇到openSSL问题的exception。 请对此提出建议。 谢谢!

问题可能是因为您在代理/防火墙之后阻止您从rubygems.org下载。 有关类似问题,请参阅rubygems.org上的以下主题:

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

安装时尝试使用–http-proxy选项。

对于无法通过–http-proxy使其工作的人,请尝试以下操作。 从以下评论中添加。

 gem install rails --http-proxy --source http://rubygems.org --debug -v