当我在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,这个问题的真正解决方案是:

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

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

其他回答

需要注意的是,如果您正在从一个SSL证书受内部证书颁发机构信任的源获取宝石(或者您正在通过带有SSL检查的公司web代理连接到一个外部源),请将SSL_CERT_FILE env变量指向您的证书链。这很可能只需要将您的根证书从证书存储(macOS上的系统密钥链)导出到您的shell中可访问的位置,即:

export SSL_CERT_FILE=~/RootCert.pem

我不得不重新安装openssl:

brew uninstall --force openssl
brew install openssl

这是如何在Windows上解决这个问题:

然后在命令提示符中设置SSL_CERT_FILE

https://gist.github.com/fnichol/867550

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

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'使继续包安装成为可能

我得到了一个类似的错误。下面是我解决这个问题的方法:在您的路径目录中,检查Gemfile。将gemfile中的源文件编辑为http而不是https并保存它。这可能会在没有SSL证书颁发的情况下安装捆绑程序