安装 rubygems 时出现 SSL 错误,无法从“https://rubygems.org/"中提取数据 [英] SSL Error When installing rubygems, Unable to pull data from 'https://rubygems.org/
问题描述
我正在尝试制作 Michael Hartl 教程.当我尝试在我的 gemset 中安装 rails 3.2.14 时,出现以下问题:
I am trying to do the Michael Hartl tutorial. When I attempt to install rails 3.2.14 in my gemset, I get the following issue:
$ gem install rails -v 3.2.14
$ gem install rails -v 3.2.14
错误:找不到有效的 gem 'rails' (= 3.2.14),原因如下:
ERROR: Could not find a valid gem 'rails' (= 3.2.14), here is why:
无法从 https://rubygems.org/ 下载数据 - SSL_connect returned=1 errno=0 state=SSLv3 读取服务器证书 B:证书验证失败(https://s3.amazonaws.com/production.s3.rubygems.org/specs.4.8.gz)
Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://s3.amazonaws.com/production.s3.rubygems.org/specs.4.8.gz)
在谷歌搜索之后,我发现我可以为 rubygems 使用非 SSL 源,所以我运行了:
After Googling around, I found that I could use a non-SSL source for rubygems so I ran:
sudo gem sources -a http://rubygems.org
然后,当我再次尝试安装rails时,它成功了.但是,我仍然遇到上述问题,但作为警告:
Then, when I tried to install rails again, it was successful. However, I still got the issue above but as a warning:
警告:无法从https://rubygems.org/'中提取数据:SSL_connect returned=1 errno=0 state=SSLv3读取服务器证书 B:证书验证失败 (https://s3.amazonaws.com/production.s3.rubygems.org/specs.4.8.gz)
WARNING: Unable to pull data from 'https://rubygems.org/': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://s3.amazonaws.com/production.s3.rubygems.org/specs.4.8.gz)
如何完全消除此警告/错误?
How can I remove this warning/error entirely?
我正在使用以下内容:
- rvm 1.22.15
- ruby 2.0.0p247(2013-06-27 修订版 41674)[x86_64-darwin12.3.0]
- OSX 10.8.5
推荐答案
For RVM &OSX 用户
确保您使用最新的 rvm:
For RVM & OSX users
Make sure you use latest rvm:
rvm get stable
那么你可以做两件事:
更新证书:
Update certificates:
rvm osx-ssl-certs update all
更新 rubygems:
Update rubygems:
rvm rubygems latest
<小时>
对于非 RVM 用户
查找证书路径:
cert_file=$(ruby -ropenssl -e 'puts OpenSSL::X509::DEFAULT_CERT_FILE')
生成证书:
security find-certificate -a -p /Library/Keychains/System.keychain > "$cert_file"
security find-certificate -a -p /System/Library/Keychains/SystemRootCertificates.keychain >> "$cert_file"
整个代码:https://github.com/wayneeseguin/rvm/blob/master/scripts/functions/osx-ssl-certs
确保更新包 ca-certificates
.(在旧系统上可能不可用 - 不要使用不再接收安全更新的旧系统)
Ruby Installer 为 windows 构建由 Luis Lavena 并且证书的路径将显示类似 C:/Users/Luis/...
检查 https://github.com/oneclick/rubyinstaller/issues/249 了解更多详情和这个答案https://stackoverflow.com/a/27298259/497756 进行修复.
The Ruby Installer builds for windows are prepared by Luis Lavena and the path to certificates will be showing something like C:/Users/Luis/...
check https://github.com/oneclick/rubyinstaller/issues/249 for more details and this answer https://stackoverflow.com/a/27298259/497756 for fix.
这篇关于安装 rubygems 时出现 SSL 错误,无法从“https://rubygems.org/"中提取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!