当我在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。

如何解决?


当前回答

在windows7上可以下载cacert。将环境变量SSL_CERT_FILE设置为您存储证书的路径

SET SSL_CERT_FILE="C:\users\<username>\cacert.pem"

或者你可以在脚本中这样设置变量ENV['SSL_CERT_FILE']="C:/users/<username>/cacert.pem"

将<username>替换为您自己的用户名。

其他回答

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

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

and

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

包完全运行!

如果你在mac上使用最新版本的RVM(~1.20),下面的命令适合我。

rvm osx-ssl-certs update

我不得不重新安装openssl:

brew uninstall --force openssl
brew install openssl

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

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安装捆绑器