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

如何解决?


当前回答

简单的复制粘贴指令这里给出关于.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.

其他回答

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

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

将ssl gem源替换为非ssl作为临时解决方案:

宝石来源-r https://rubygems.org/ 宝石来源- http://rubygems.org/

这招对我很管用:

在https://rubygems.org/pages/download下载最新的gem 使用gem Install——local[下载gem文件的路径]安装gem 使用update_rubygems更新宝石 使用gem——version检查您使用的是最新的gem版本

我对Windows的永久修复:

下载CACert,保存为C:\ruby\ssl_certs\GlobalSignRootCA。Pem来自http://guides.rubygems.org/ssl-certificate-update/ 创建名为“SSL_CERT_FILE”的系统变量,设置为C:\ruby\ssl_certs\GlobalSignRootCA.pem。 重试:gem安装bundle:

C: \宝石来源 ***当前来源*** https://rubygems.org/ C:\gem安装捆绑器 抓取:bundler-1.13.5。宝石(100%) 成功安装bundle -1.13.5 安装1个宝石