由于windows中的openssl / ETimedout,gem install rails不起作用 [英] gem install rails doesn't work due to openssl/ETimedout in windows

查看:121
本文介绍了由于windows中的openssl / ETimedout,gem install rails不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最初,我在Windows 7中安装了 ruby​​ 1.9.3 版本,并安装了 ruby​​ 2.0.0p195 ,并且已经从命令提示符( ruby​​ -v; ruby​​ -eputs 100; irb )进行了测试,效果不错。



ruby​​ -v 给出 ruby​​ 2.0.0p195(2013-05-14)[i386-mingw32]



gem -v 给我 2.0.2



当我试图安装rails时,我总是得到下面的错误:

with http://rubygems.org

  C:\ Users \san> gem install rails --source http://rubygems.org 
错误:无法找到有效的gem'rails'(> = 0),原因如下:
无法从https://rubygems.org/下载数据 - Errno :: ETIMEDOUT:
连接尝试失败,因为连接方在一段时间后没有正确响应
d,或者建立连接失败b因为连接的主机
t没有响应。 - connect(2)(https://rubygems.org/latest_specs.4.8.gz)



使用 https://rubygems.org

  C:\Users\san> gem install rails --debug -V 
在C语言中的Errno :: EEXIST异常:/Ruby200/lib/ruby/2.0.0/fileutils.rb:245 - 文件e
xists - C:/Users/san/.gem/specs/rubygems.org%443
HEAD https: //rubygems.org/latest_specs.4.8.gz
C:/Ruby200/lib/ruby/2.0.0/openssl/bufferin中的`OpenSSL :: SSL :: SSLError'异常
g.rb: 174 - 读取将阻止
302暂时移动
HEAD https://s3.amazonaws.com/production.s3.rubygems.org/latest_specs.4.8.gz
异常`OpenSSL :: SSL :: SSLError'在C:/Ruby200/lib/ruby/2.0.0/openssl/bufferin
g.rb:174 - 读取将阻止
200 OK
GET https:// ruby​​gems .org / latest_specs.4.8.gz
C:/Ruby200/lib/ruby/2.0.0/net/http.rb:878处的`Errno :: ETIMEDOUT'异常 - co
连接尝试失败因为关联方在一段时间内没有正确响应a
,或者建立的连接失败,因为连接的主机有
未能响应。 - connect(2)

由于我收到如此多的错误,我卸载了ruby版本和重新启动系统并安装回去(在Google搜索之后,以及从几个计算器问题中提出)。但没有多大帮助。
注意:我已关闭Windows防火墙并尝试安装。但我仍然在openSSL问题上得到Exception。
请在此建议。感谢!

解决方案

这个问题可能是因为你在代理/防火墙后面,阻止你从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 


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!

解决方案

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

这篇关于由于windows中的openssl / ETimedout,gem install rails不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆