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

当我在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进行开发工作。

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

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

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

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

 source 'https://rubygems.org' 

 source 'http://rubygems.org'