rvm:安装Rails时证书验证失败

时间:2016-11-29 20:44:55

标签: ruby-on-rails ruby rvm

我第一次尝试ruby-2.3.0。我是从rvm安装的。安装后,我尝试安装Rails:

$ rvm-prompt
ruby-2.3.0@mygemset

$ rvm osx-ssl-certs update all
Updating certificates for /etc/openssl/cert.pem: Updating certificates in '/etc/openssl/cert.pem'.
Updated.
Updating certificates for /usr/local/etc/openssl/cert.pem: Already up to date.

$ rvm rubygems latest
Installed rubygems 2.5.1 is newer than 2.4.8 provided with installed ruby, skipping installation, use --force to force installation.

$ gem install rails
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)

为什么我收到错误certificate verify failed?当我导航到浏览器上的链接https://api.rubygems.org/specs.4.8.gz时,它会毫无问题地下载。

1 个答案:

答案 0 :(得分:0)

看看https://gist.github.com/luislavena/f064211759ee0f806c88(另请参阅rubygems gem repo本身的问题#1050:https://github.com/rubygems/rubygems/issues/1050如果你想要一些很好的就寝时间阅读)

要点(没有双关语)是RubyGems必须以不能通过rubygems本身部署的方式更新其SSL证书。

您需要进行一次手动安装/更新rubygems