我已经安装了宝石,当我输入gem -v时,一切都通过OK。我有Windows 10,教室环境,Ruby v 2.2;但是当我跑去测试或执行上述命令时,我得到以下内容。
Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies.....
Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://rubygems.global.ssl.fastly.net/gems/rake-11.2.2.gem)
Using i18n 0.7.0
Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://rubygems.global.ssl.fastly.net/gems/json-1.8.3.gem)
Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://rubygems.global.ssl.fastly.net/gems/minitest-5.9.0.gem)
Using thread_safe 0.3.5
Using builder 3.2.2
Using erubis 2.7.0
Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://rubygems.global.ssl.fastly.net/gems/mini_portile2-2.1.0.gem)
Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://rubygems.global.ssl.fastly.net/gems/pkg-config-1.1.7.gem)
Using rack 1.6.4
Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://rubygems.global.ssl.fastly.net/gems/mime-types-data-3.2016.0521.gem)
Using arel 6.0.3
Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://rubygems.global.ssl.fastly.net/gems/debug_inspector-0.0.2.gem)
Using bundler 1.11.2
Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://rubygems.global.ssl.fastly.net/gems/byebug-9.0.5.gem)
Using coffee-script-source 1.10.0
Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://rubygems.global.ssl.fastly.net/gems/execjs-2.7.0.gem)
Using thor 0.19.1
Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://rubygems.global.ssl.fastly.net/gems/concurrent-ruby-1.0.2.gem)
Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://rubygems.global.ssl.fastly.net/gems/multi_json-1.12.1.gem)
Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://rubygems.global.ssl.fastly.net/gems/mysql2-0.4.4-x86-mingw32.gem)
Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://rubygems.global.ssl.fastly.net/gems/sass-3.4.22.gem)
Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://rubygems.global.ssl.fastly.net/gems/tilt-2.0.5.gem)
Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://rubygems.global.ssl.fastly.net/gems/turbolinks-source-5.0.0.gem)
An error occurred while installing rake (11.2.2), and Bundler cannot continue.
Make sure that `gem install rake -v '11.2.2'` succeeds before bundling.
答案 0 :(得分:-1)
请按照以下说明解决您的问题。
步骤很简单:
第1步:获取新的信任证书
我们需要下载AddTrustExternalCARoot-2048.pem。
使用上面的链接并将此文件放置/保存在以后您可以轻松找到的地方(例如您的桌面)。
重要提示:文件必须以.pem作为扩展名。像Chrome这样的浏览器会尝试将其保存为纯文本文件。确保在下载后更改文件名以包含.pem。
步骤2:在您的安装中找到RubyGems证书目录
为了让我们复制这个文件,我们需要知道把它放在哪里。
根据您安装Ruby的位置,目录将有所不同。
以Ruby 2.1.5的默认安装为例,放置在C:\ Ruby21
中打开命令提示符并输入:
C:>宝石哪个rubygems C:/Ruby21/lib/ruby/2.1.0/rubygems.rb 现在,让我们找到该目录。在同一窗口中,输入路径部分直到文件扩展名,但使用反斜杠:
C:>启动C:\ Ruby21 \ lib \ ruby \ 2.1.0 \ rubygems 这将在我们指示的目录中打开一个资源管理器窗口。
第3步:复制新的信任证书
现在,找到ssl_certs目录并复制我们从上一步中获得的.pem文件。
它将与其他文件一起列出,例如GeoTrustGlobalCA.pem。
第4步:获利
实际上没有第4步。您应该能够立即安装Ruby gems。