Rubygems的SSL错误(无法连接)

时间:2016-11-27 22:30:09

标签: ruby-on-rails ruby ssl openssl rubygems

我已经通过RVM安装了ruby 2.3.3的新版本,并且我尝试安装rails(gem install rails)但是,当我这样做时,我收到以下错误:

错误:找不到有效的宝石' rails' (> = 0),原因如下:                 无法从https://rubygems.org/下载数据 - SSL_connect返回= 1 errno = 0状态=错误:证书验证失败(https://api.rubygems.org/specs.4.8.gz

我已按照rubygem上SSL证书页面上的说明进行操作,但无济于事。我在rubygems中找到的每个证书似乎都与最新版本匹配。

我还运行gem update --system并收到以下错误:

ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
        SSL_connect returned=1 errno=0 state=error: certificate verify failed (https://api.rubygems.org/specs.4.8.gz)

Lastly, here is the output of `gem env`:

 RubyGems Environment:
  - RUBYGEMS VERSION: 2.5.2
  - RUBY VERSION: 2.3.3 (2016-11-21 patchlevel 222) [x86_64-darwin14]
  - INSTALLATION DIRECTORY: /Users/adammay/.rvm/gems/ruby-2.3.3
  - USER INSTALLATION DIRECTORY: /Users/adammay/.gem/ruby/2.3.0
  - RUBY EXECUTABLE: /Users/adammay/.rvm/rubies/ruby-2.3.3/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/adammay/.rvm/gems/ruby-2.3.3/bin
  - SPEC CACHE DIRECTORY: /Users/adammay/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Users/adammay/.rvm/rubies/ruby-2.3.3/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-14
  - GEM PATHS:
     - /Users/adammay/.rvm/gems/ruby-2.3.3
     - /Users/adammay/.rvm/gems/ruby-2.3.3@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - "gem" => "--no-ri --no-rdoc"
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /Users/adammay/.rvm/gems/ruby-2.3.3/bin
     - /Users/adammay/.rvm/gems/ruby-2.3.3@global/bin
     - /Users/adammay/.rvm/rubies/ruby-2.3.3/bin
     - /Users/adammay/.rvm/bin
     - /Applications/Postgres.app/Contents/Versions/9.4/bin
     - /usr/local
     - /usr/local/bin
     - /usr/local/sbin
     - /usr/bin
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin

1 个答案:

答案 0 :(得分:-1)

您可以尝试这样做,它可以解决您的问题。

gem update --system --source http://rubygems.org/

现在您已准备好使用gem updategem install rails