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

如何解决?


当前回答

如果你使用的是rails资产

如果您使用https://rails-assets.org/来管理您的资产,没有答案可以帮助您。即使转换为http也无济于事。

最简单的解决方法是使用这个源代码http://insecure.rails-assets.org。他们的主页上已经提到了这一点。

其他回答

原因是古老的红宝石。您需要先使用非ssl源更新系统部分:

Gem update——system——source http://rubygems.org/(使用非ssl连接临时更新系统部分)。

现在您已经准备好使用gem更新了。

这个问题现在应该得到解决。更新rubygems (gem Update——system),确保openssl在你的操作系统上是最新版本,或者尝试这些提示,它仍然无法工作:http://railsapps.github.com/openssl-certificate-verify-failed.html

简单的复制粘贴指令这里给出关于.pem文件

https://gist.github.com/luislavena/f064211759ee0f806c88

证书验证失败

If you've read the previous sections, you will know what this means (and shame > on you if you have not). We need to download AddTrustExternalCARoot-2048.pem. Open a Command Prompt and type in: C:>gem which rubygems C:/Ruby21/lib/ruby/2.1.0/rubygems.rb Now, let's locate that directory. From within the same window, enter the path part up to the file extension, but using backslashes instead: C:>start C:\Ruby21\lib\ruby\2.1.0\rubygems This will open a Explorer window inside the directory we indicated. Step 3: Copy new trust certificate Now, locate ssl_certs directory and copy the .pem file we obtained from previous step inside. It will be listed with other files like GeoTrustGlobalCA.pem.

下载rubygems-update-2.6.7。宝石。

现在,使用命令提示符:

C:\>gem install --local C:\rubygems-update-2.6.7.gem
C:\>update_rubygems --no-ri --no-rdoc

在此之后,gem——version应该报告新的更新版本。

您现在可以安全地卸载rubygems-update gem:

C:\>gem uninstall rubygems-update -x
Removing update_rubygems
Successfully uninstalled rubygems-update-2.6.7

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

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

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