Error installing Bundler

2019-01-22 06:45发布

I am trying to install the Bundler gem on my Mac. With the command: sudo gem install bundler I get the following error:

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 --system is currently up-to-date. Is there an alternative way to get Bundler?

11条回答
够拽才男人
2楼-- · 2019-01-22 07:28

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.

查看更多
来,给爷笑一个
3楼-- · 2019-01-22 07:29

Had the same issue and everything is described here: http://railsapps.github.io/openssl-certificate-verify-failed.html

tl;dr Recent 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.

If you’ve installed RVM, try this:

$ 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).

查看更多
Evening l夕情丶
4楼-- · 2019-01-22 07:41

for those Chinese users:

$ 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

查看更多
闹够了就滚
5楼-- · 2019-01-22 07:42

Try gem source -c and then install bundler again that should solve the problem

查看更多
Explosion°爆炸
6楼-- · 2019-01-22 07:43

Windows users:

You can't run rvm command on Windows as you can see here, but you can fix the error without it. Just add a new source adress with http instead of https:

gem sources -a http://rubygems.org

Then you can run:

gem install bundler
查看更多
登录 后发表回答