Ruby gem cucumber SSL 错误和 Gem 来源 [英] Ruby gem cucumber SSL error and Gem sources
问题描述
我正在尝试为 Ruby 安装黄瓜 gem.尽管与此相关的主题很少,但我找不到确切答案的确切问题.在 Windows 上,我尝试运行命令 gem install cucumber
并返回控制台:
I was trying to install cucumber gem for Ruby.
Although there were few topics somewhat related to this, I can't find exact question with exact answer. When on Windows I try to run the command gem install cucumber
and the console returned:
错误:无法从 https://rubygems.org/ 下载数据 -SSL_connect 返回=1 errno=0 state=SSLv3 读取服务器证书B:证书验证失败(https://s3.amazonaws.com/production.s3.rubygems.org/specs.4.8.gz)
ERROR: 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)
然后,我搜索了一个解决方案,并在 here 中找到了一些删除源的建议.我运行了 gem sources -r
,它已被删除.
Then, I googled for a solution and found some suggestions to remove source in here. I ran gem sources -r
and it has been removed.
但这样做不仅在黄瓜中.现在我什至无法添加来源.
But did that not only in cucumber. Now I'm even unable to add source.
推荐答案
我在迁移到 ruby 2.0.0 后不久遇到了同样的问题
I had the same issue a while back after moving to ruby 2.0.0
按照以下步骤解决
1) 访问网址 http://curl.haxx.se/ca/cacert.pem 将内容保存为 .pem 文件(不要将其保存为文本文件.确保扩展名为 .pem)
1)Visit the url http://curl.haxx.se/ca/cacert.pem save the contents as a .pem file(Do not save it as a text file.Make sure the extension is .pem)
2)将文件复制到本地的任何路径,例如:C: uby200ca_cert.pem(在我的情况下)
2)Copy the file to any path in your local eg: C: uby200ca_cert.pem (in my case)
3) 现在添加一个带有变量 SSL_CERT_FILE 和值C: uby200ca_cert.pem"(不带引号)的环境变量(路径在我的情况下.替换为适当的路径)(可以通过导航到添加环境变量计算机 -> 高级设置 -> 环境变量)
3)Now add an Environment variable with Variable SSL_CERT_FILE and value "C: uby200ca_cert.pem"(without quotes)(path is in my case.Replace with appropriate path) (Environment variables can be added by navigating to Computer -> Advanced Settings -> Environment Variables)
4)关闭所有命令提示符并重新启动它们.现在应该可以正常工作了
4)Close all your command prompts and restart them.Things should work fine now
这篇关于Ruby gem cucumber SSL 错误和 Gem 来源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!