ruby 安装 Bundler 时出错
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19132450/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error installing Bundler
提问by Fisu
I am trying to install the Bundler gem on my Mac. With the command:
sudo gem install bundlerI get the following error:
我正在尝试在我的 Mac 上安装 Bundler gem。使用命令:
sudo gem install bundler我收到以下错误:
ERROR: Could not find a valid gem 'bundler' (>= 0), here is why:
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/latest_specs.4.8.gz)
It clearly seems to be a server issue, but how do I go about solving this? gem update --systemis currently up-to-date. Is there an alternative way to get Bundler?
这显然似乎是服务器问题,但我该如何解决这个问题?gem update --system目前是最新的。有没有其他方法可以获得 Bundler?
回答by Yaron
Had the same issue and everything is described here: http://railsapps.github.io/openssl-certificate-verify-failed.html
有同样的问题,这里描述了一切:http: //railsapps.github.io/openssl-certificate-verify-failed.html
tl;drRecent versions of RVM, the Ruby Version Manager, include a utility to diagnose and resolve errors caused by outdated certificate files. See the article Installing Rails for instructions and advice. The RVM website explains how to install RVM.
tl;drRVM 的最新版本,即 Ruby 版本管理器,包括一个实用程序,用于诊断和解决由过期证书文件引起的错误。有关说明和建议,请参阅安装 Rails 一文。RVM 网站解释了如何安装 RVM。
If you've installed RVM, try this:
如果你已经安装了 RVM,试试这个:
$ rvm -v
# rvm 1.19.1 (stable)
$ rvm osx-ssl-certs status all
# Certificates for...
$ rvm osx-ssl-certs update all
# Updating certificates...
That's all that is needed to resolve the issue if you are using RVM (you must be using RVM version 1.19.1 or newer).
如果您使用 RVM(您必须使用 RVM 1.19.1 或更新版本),这就是解决问题所需的全部内容。
回答by fabriciorissetto
Windows users:
视窗用户:
You can't run rvmcommand on Windows as you can see here, but you can fix the error without it. Just add a new source adress with httpinstead of https:
rvm正如您在此处看到的,您无法在 Windows 上运行命令,但您可以在没有它的情况下修复错误。只需使用http而不是http s添加一个新的源地址:
gem sources -a http://rubygems.org
Then you can run:
然后你可以运行:
gem install bundler
回答by Fisu
After looking at some of the answers to the Stack question@Matt referenced, although the error was different, one of the solutionsalso helped me for this problem.
在查看了@Matt 引用的Stack 问题的一些答案后,虽然错误不同,但其中一个解决方案也帮助我解决了这个问题。
In the home directory, create a file called .gemrc. Add :ssl_verify_mode: 0to the file. Bundler then installs without issue.
在主目录中,创建一个名为.gemrc. 添加:ssl_verify_mode: 0到文件中。Bundler 然后安装没有问题。
This works for my situation as I'm behind a corporate firewall. However, this obviously opens up a security hole.
这适用于我的情况,因为我在公司防火墙后面。然而,这显然打开了一个安全漏洞。
回答by David Ben Dahan
I had this same problem using Windows, and removing the security from the Hypertext Transfer Protocol solve it.
我在使用 Windows 时遇到了同样的问题,从超文本传输协议中删除安全性可以解决它。
Paste in your terminal:
粘贴到您的终端中:
gem sources -r https://rubygems.org-a http://rubygems.org
gem sources -r https://rubygems.org-a http://rubygems.org
Hope it will help! ★
希望它会有所帮助!★
回答by Luke Hamilton
For those that arent using rvm, but are using homebrew:
对于那些不使用 rvm 但使用自制软件的人:
brew tap raggi/ale
brew install openssl-osx-ca
This worked for me.
这对我有用。
回答by Placid
I faced the same problem installing bundler on windows 8.1. I solved it and installed bundler and other gems in the following way
我在 Windows 8.1 上安装 bundler 时遇到了同样的问题。我解决了它并通过以下方式安装了 bundler 和其他 gems
- Go to https://gist.github.com/luislavena/f064211759ee0f806c88and follow instructions.
My gem version was 2.2.2. Update gem to 2.4.5 with the command:
gem update --system
Install gems:
gem install bundler
gem install rails
- 转到https://gist.github.com/luislavena/f064211759ee0f806c88并按照说明进行操作。
我的 gem 版本是 2.2.2。使用以下命令将 gem 更新到 2.4.5:
宝石更新--系统
安装宝石:
宝石安装捆绑器
宝石安装导轨
Hope that helps.
希望有帮助。
回答by Jaskey
Below way solve my problem:
下面的方法解决我的问题:
- In the home directory , find file
.gemrc edit this file and find
:sources: -https://rubygems.org/
change
httpsintohttp- save the file and reopen the shell.
- 在主目录中,找到文件
.gemrc 编辑此文件并找到
:来源: - https://rubygems.org/
改变
https成http- 保存文件并重新打开外壳。
回答by Mark Seemann
Finding this answer a couple of years later, I didn't feel comfortable with making my installation less secure, so I updated my Ruby installation to Ruby 2.2.2, which made the problem go away.
几年后找到这个答案,我对降低安装的安全性感到不舒服,所以我将我的 Ruby 安装更新到 Ruby 2.2.2,这使问题消失了。
回答by Christian Chen
- Here is my error when I input the command
sudo gem install bundler --no-ri --no-rdoc.
- 这是我输入命令时的错误
sudo gem install bundler --no-ri --no-rdoc。
ERROR: Could not find a valid gem 'bundler' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - Errno::ECONNRESET: Connection reset by peer - SSL_connect (https://api.rubygems.org/latest_specs.4.8.gz)
ERROR: Could not find a valid gem 'bundler' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - Errno::ECONNRESET: Connection reset by peer - SSL_connect (https://api.rubygems.org/latest_specs.4.8.gz)
- And my solution is input the next command lines:
- 我的解决方案是输入下一个命令行:
gem sources --remove https://rubygems.org/
gem sources --remove https://rubygems.org/
gem sources --remove http://rubygems.org/
gem sources --remove http://rubygems.org/
gem sources -l
gem sources -l
and the output show:
和输出显示:
*** CURRENT SOURCES ***
http://rubygems.org/
*** CURRENT SOURCES ***
http://rubygems.org/
- Then, try
sudo gem install bundler --no-ri --no-rdocagain:
- 然后,再试
sudo gem install bundler --no-ri --no-rdoc一次:
Fetching: bundler-1.11.2.gem (100%)
Successfully installed bundler-1.11.2
1 gem installed
Fetching: bundler-1.11.2.gem (100%)
Successfully installed bundler-1.11.2
1 gem installed
Bingo!!!
答对了!!!
回答by u445908
for those Chinese users:
对于那些 CN 用户:
$ gem install bundler
ERROR: Could not find a valid gem 'bundler' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - Errno::ECONNRESET: Connection reset by peer - SSL_connect (https://api.rubygems.org/latest_specs.4.8.gz)
$ gem sources --add https://ruby.taobao.org/ --remove https://rubygems.org/
$ gem sources -l
*** CURRENT SOURCES ***
https://ruby.taobao.org/
$ gem install bundler
Fetching: bundler-1.12.5.gem (100%)
Successfully installed bundler-1.12.5
Parsing documentation for bundler-1.12.5
Installing ri documentation for bundler-1.12.5
Done installing documentation for bundler after 4 seconds
1 gem installed
My environment: rbenv, ruby 2.1.2, ubuntu 16.04 LTS
我的环境:rbenv、ruby 2.1.2、ubuntu 16.04 LTS

