如何解决bundle install rake error和Gem :: RemoteFetcher :: FetchError

时间:2015-03-23 00:51:27

标签: ruby-on-rails ruby ruby-on-rails-3 gem rubygems

当我在ruby 2.1.2上运行bundle install时,我得到:

Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://rubygems.org/gems/rake-10.4.2.gem)
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.

当我运行gem install rake时,我得到:

ERROR:  Could not find a valid gem 'bundle' (>= 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

当我运行which bundle时,我得到:

/usr/local/rvm/gems/ruby-2.1.2@global/bin/bundle

此错误阻止我在部署之前对localhost:3000进行开发工作。

有谁知道如何解决这个问题?

2 个答案:

答案 0 :(得分:14)

在rails应用程序目录中的Gemfile中更改:

source 'https://rubygems.org'

source 'http://rubygems.org'

答案 1 :(得分:2)

升级到最新版本的Ruby或至少比您拥有的版本更新。我使用2.0.0-p247并收到了同样的错误。当我升级到2.2.5(这是撰写本文时支持最早的版本)时,一切正常。

升级ruby后我还必须运行gem install bundler。最后,我使用rbenv并使用rbenv install 2.2.5安装了ruby,然后运行rbenv local 2.2.5