安装红宝石宝石时超时

Mat*_*att 2 ruby rubygems

我正在尝试使用安装bundler gem $ gem install bundler.当我执行命令时,收到以下响应:

ERROR:  Could not find a valid gem 'bundler' (>= 0), here is why:
    Unable to download data from https://rubygems.org/ - Errno::ETIMEDOUT: Operation   timed out - connect(2) (https://api.rubygems.org/latest_specs.4.8.gz)
ERROR:  Possible alternatives: bundler
Run Code Online (Sandbox Code Playgroud)

为了确保我不会发疯,我尝试安装nokogiri:

ERROR:  Could not find a valid gem 'nokogiri' (>= 0), here is why:
  Unable to download data from https://rubygems.org/ - Errno::ETIMEDOUT: Operation timed out - connect(2) (https://api.rubygems.org/latest_specs.4.8.gz)
ERROR:  Possible alternatives: nokogiri
Run Code Online (Sandbox Code Playgroud)

和a2z:

ERROR:  Could not find a valid gem 'a2z' (>= 0), here is why:
  Unable to download data from https://rubygems.org/ - Errno::ETIMEDOUT: Operation timed out - connect(2) (https://api.rubygems.org/quick/Marshal.4.8/a2z-0.1.3.gemspec.rz)
Run Code Online (Sandbox Code Playgroud)

如果有人以前经历过这个问题,可以帮助我,我将不胜感激.

如果它有帮助,我正在运行MacOS Mavericks并拥有宝石版2.2.2.

小智 15

太晚了,但我解决了这个问题,在我的系统操作系统中禁用 IPv6 连接。它强制操作系统只使用 IPv4,然后它就可以工作了。

  • 在 Debian 上: `sysctl -w net.ipv6.conf.default.disable_ipv6=1; sysctl -w net.ipv6.conf.all.disable_ipv6=1` (2认同)

小智 6

在你的Gemfile中设置你的

source 'http://production.s3.rubygems.org'

这可能不是一个官方的答案,但在尝试访问rubygems.org三个令人沮丧的日子之后,它对我有用.

  • 你能举一个完整的命令行的例子吗?你把源放在安装命令前面还是后面? (2认同)

小智 5

我遇到了同样的问题,通过禁用 VPN 解决了​​这个问题。尝试查看代理、VPN 和其他网络问题。


Roa*_*ald 5

对于使用 Windows 的人,以下内容在 Windows 10上对我有用。另请参阅我对 ruby​​ gems 问题列表的回复。

  1. 转到控制面板 > 网络和 Internet > 网络连接
  2. 选择您当前使用的网络连接
  3. 右键单击它并选择属性
  4. 删除 Internet 协议版本 6 (TCP/IPv6) 的复选标记
  5. 单击确定
  6. 再次运行您的 gem 命令