无法访问 RubyGems - 可能是由于 SSL? [英] Can't access RubyGems - possibly due to SSL?

查看:27
本文介绍了无法访问 RubyGems - 可能是由于 SSL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里是新的 Ruby on Rails 开发人员,只是尝试安装和设置.

New Ruby on Rails dev here, just trying to install and get set up.

我正在关注如何开始的本指南.但是,当我进入 3.2 创建博客应用程序时,我在运行 rails new blog 时遇到了问题.当我尝试这样做时,我收到一个错误,上面写着

I'm following this guide on how to get started. However, when I get to 3.2 Creating the Blog Application, I run into an issue when I run rails new blog. When I try that, I get an error that says

安装 rake 10.4.2 时出错,Bundler 无法继续.在捆绑之前确保 'gem install rake -v '10.4.2'' 成功.

An error occurred while installing rake 10.4.2, and Bundler cannot continue. Make sure that 'gem install rake -v '10.4.2'' succeeds before bundling.

所以,当我尝试运行该命令时,我得到了这个错误:

So, when I try to run that command, I get this error:

错误:找不到有效的 gem 'rake':无法从 https://rubygems.org/下载数据a> - SSL_connect 返回=1 errno=0 state=SSLv3 读取服务器证书B:证书验证失败

ERROR: Could not find a valid gem 'rake': Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

谷歌搜索后,我找到了本指南.在诊断部分,我尝试运行 openssl version,但没有成功.我安装了 OpenSSL 并将其添加到我的路径中.但是,当我尝试获取任何宝石时,我仍然会遇到相同的错误.我也无法 ping ruby​​gems.org - 没有任何回复.

After Googling around, I found this guide. During the diagnosis portion, I tried running openssl version, which didn't work. I installed OpenSSL and added it to my path. However, I still get the same error when I try to fetch any gems. I also can't ping rubygems.org - nothing comes back.

我使用的是 Windows 7、Rails 4.1.8、Ruby 2.0.0p598、RubyGems 2.0.14 和 OpenSSL 1.01j.任何帮助将不胜感激!

I'm using Windows 7, Rails 4.1.8, Ruby 2.0.0p598, RubyGems 2.0.14, and OpenSSL 1.01j. Any help would be greatly appreciated!

推荐答案

这里有一个快速的解决方案:

Here is a quick solution:

转到您的 gem 文件并进行更改

Go to your gem file and change

source 'https://rubygems.org' 

source 'http://rubygems.org' #remove the 's' 

在 StackOverflow 上查看此 类似问题 以获得更多解决方案并深入了解错误:)

Check this similar question on StackOverflow for more solutions and insights into the error :)

根据@Anthony 在以下评论中的输入,这是一个更永久的解决方案:

Based on inputs by @Anthony in the comments below, here is a more permanent solution :

下载:AddTrustExternalCARoot-2048.pem.(注意:文件必须以 .pem 作为扩展名.Chrome 等浏览器会尝试将其保存为纯文本文件.请确保在下载后将文件名更改为包含 .pem.)

Download : AddTrustExternalCARoot-2048.pem.(Note: File must have .pem as extension. Browsers like Chrome will try to save it as plain text file. Ensure you change the filename to have .pem in it after you have downloaded it.)

现在在命令提示符下运行以下命令:

Now Run the following in your command prompt:

C:>gem which rubygems

Thiw 将为您提供需要放置上述 .pem 文件的路径.在路径指向的目录内导航.在里面找到ssl_certs目录,把我们上一步得到的.pem文件复制进去.

Thiw will give you a path where you need to place the above .pem file. Navigate inside the directory to which the path points. Inside it locate ssl_certs directory and copy the .pem file we obtained from previous step inside.

这样就可以了!

这篇关于无法访问 RubyGems - 可能是由于 SSL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆