Ruby Gem安装错误

时间:2014-03-17 16:57:36

标签: ruby-on-rails gem installation

我无法在计算机上安装Ruby on Rails gem。这是我输入的内容和收到的回复。

C:\Users\029607\Documents\NDAC Tech Studies\TES3>gem install bundler --source "http://rubygems.org"

这是回复:

Successfully installed bundler-1.5.3
WARNING:  Unable to pull data from 'https://rubygems.org/': SSL_connect SYSCALL
returned=5 errno=0 state=SSLv2/v3 read server hello A (https://api.rubygems.org/
latest_specs.4.8.gz)
1 gem installed

C:\Users\029607\Documents\NDAC Tech Studies\TES3>bundle install

Fetching source index from https://rubygems.org/
Retrying source fetch due to error (2/3): Bundler::HTTPError Could not fetch specs from https://rubygems.org/
Retrying source fetch due to error (3/3): Bundler::HTTPError Could not fetch specs from https://rubygems.org/
Could not fetch specs from https://rubygems.org/

2 个答案:

答案 0 :(得分:0)

这似乎是Ruby和你的TLS握手的问题。尝试定义证书here

Here是其他可能的解决方案。

答案 1 :(得分:0)

您需要获取更多信息:bundle install --verbose

我遇到了同样的错误,当我确实捆绑安装时,它变得更加清晰。就我而言..

Gem::RemoteFetcher::FetchError: Errno::ETIMEDOUT: Connection timed out 
 - connect(2) for "s3.amazonaws.com" port 443 (https://rubygems.org/specs.4.8.gz)

它表明存在防火墙问题(您需要在端口443上允许防火墙访问rubygems.org和s3.amazonaws.com)。

我正在nslookup rubygems.org获取IP地址并在whois ip address中使用它并使用CIDR地址(54.240.0.0/12等)来允许通过防火墙访问ruby gems。我对Rubygems的Iptables看起来像这样,同时允许已建立的流量。 (您可以同样拥有出站流量许可政策,您不需要复杂的防火墙表;-))

-A service -d 54.240.0.0/12 -o eth0 -p tcp -m tcp --dport 443 -j ACCEPT
-A service -d 205.251.192.0/18 -o eth0 -p tcp -m tcp --dport 443 -j ACCEPT
-A service -d 54.216.0.0/14 -o eth0 -p tcp -m tcp --dport 443 -j ACCEPT
-A service -d 54.220.0.0/15 -o eth0 -p tcp -m tcp --dport 443 -j ACCEPT
-A service -d 54.208.0.0/13 -o eth0 -p tcp -m tcp --dport 443 -j ACCEPT