Rubygems的SSL错误(无法连接) [英] SSL error with Rubygems (unable to connect)

查看:559
本文介绍了Rubygems的SSL错误(无法连接)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经通过RVM安装了ruby 2.3.3的新版本,但是当我尝试安装导轨(gem install rails)时,出现以下错误:

I've installed a fresh version of ruby 2.3.3 via RVM and I'm attempting to install rails (gem install rails) however, when I do I receive the following error:

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

ERROR: Could not find a valid gem 'rails' (>= 0), here is why: Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=error: certificate verify failed (https://api.rubygems.org/specs.4.8.gz)

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

I have followed the instructions on the SSL cert page on rubygem to no avail. Every cert I can find within rubygems seems to match the most recent version.

我也已经运行gem update --system并收到以下错误:

I have also run gem update --system and receive the following error:

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

推荐答案

您可以尝试执行此操作,它可以解决您的问题.

You can try to do this, it can fix your problems.

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

现在您可以使用gem updategem install rails

这篇关于Rubygems的SSL错误(无法连接)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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