红宝石不能安装宝石,只能手动

时间:2018-11-28 20:53:45

标签: ruby rubygems

标题说明了一切,每当我尝试安装gem时,就会发生这种情况:

  

错误:找不到有效的gem'ruby2d'(> = 0),这是原因:             无法从https://rubygems.org/下载数据-超时(https://api.rubygems.org/specs.4.8.gz

我重新安装了ruby来尝试解决此问题,但没有任何运气。 另外,我尝试更新rubygems版本,出现此错误:

  

错误:执行gem时...(Gem :: RemoteFetcher :: UnknownHostError)       超时(https://api.rubygems.org/specs.4.8.gz

 RubyGems Environment:
  - RUBYGEMS VERSION: 2.7.6
  - RUBY VERSION: 2.5.3 (2018-10-18 patchlevel 105) [x64-mingw32]
  - INSTALLATION DIRECTORY: C:/Ruby25-x64/lib/ruby/gems/2.5.0
  - USER INSTALLATION DIRECTORY: C:/Users/julia_ps3fg4w/.gem/ruby/2.5.0
  - RUBY EXECUTABLE: C:/Ruby25-x64/bin/ruby.exe
  - EXECUTABLE DIRECTORY: C:/Ruby25-x64/bin
  - SPEC CACHE DIRECTORY: C:/Users/julia_ps3fg4w/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: C:/ProgramData
  - RUBYGEMS PLATFORMS:
    - ruby
    - x64-mingw32
  - GEM PATHS:
     - C:/Ruby25-x64/lib/ruby/gems/2.5.0
     - C:/Users/julia_ps3fg4w/.gem/ruby/2.5.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:

2 个答案:

答案 0 :(得分:0)

您似乎在gem配置中缺少源。试试这个。

gem sources -a  http://rubygems.org

它应将您的~/.gemrc文件编辑如下:

---
:backtrace: false
:bulk_threshold: 1000
:sources:
- http://rubygems.org
:update_sources: true
:verbose: true

答案 1 :(得分:0)

https://github.com/rubygems/rubygems/issues/2253

TL; DR:某些ipv6请求没有通过。使用ipv4