当我在Centos 5.5上为我的Rails 3项目运行捆绑安装时,它失败了,出现了一个错误:

Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 
read server certificate B: certificate verify failed 
(https://bb-m.rubygems.org/gems/multi_json-1.3.2.gem)
An error occured while installing multi_json (1.3.2), and Bundler cannot continue.
Make sure that `gem install multi_json -v '1.3.2'` succeeds before bundling.

当我尝试手动安装gem(通过gem install multi_json -v '1.3.2')它工作。同样的问题也发生在其他宝石上。我使用RVM (1.12.3), ruby 1.9.2, bundle 1.1.3。

如何解决?


当前回答

最简单的解决方案:

rvm pkg install openssl
rvm reinstall all --force

拖鞋!

其他回答

同样的问题,但不同的宝石:

Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 
read server certificate B: certificate verify failed 
(https://bb-m.rubygems.org/gems/builder-3.0.0.gem)
An error occured while installing builder (3.0.0), and Bundler cannot continue.
Make sure that `gem install builder -v '3.0.0'` succeeds before bundling.

临时解决方案:gem install builder -v '3.0.0'使继续包安装成为可能

谢谢@亚历山大。Iljushkin:

Gem更新——system——source http://rubygems.org/

在那之后,捆绑器仍然失败了,解决方案是:

Gem安装捆绑器

我最近遇到了这个问题,并遵循了下面列出的步骤。您可能没有指向正确的OpenSSL证书。在运行:

rvm osx-ssl-certs status all
rvm osx-ssl-certs update all

and

export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt

包完全运行!

如果你使用RVM,这个问题的真正解决方案是:

Update rubygems: gem Update——system RVM osx-ssl-certs update all .使用RVM方式刷新SSL certs

向RailsApps项目的这个技巧致敬!

您可以从curl的网站http://curl.haxx.se/ca/cacert.pem下载CA证书列表

然后设置SSL_CERT_FILE环境变量,告诉Ruby使用它。例如,在Linux中:

$ SSL_CERT_FILE=~/cacert.pem bundle install

(参考:https://gist.github.com/fnichol/867550)