Я работаю на сайте Jekyll без проблем в течение месяца, но с этой недели каждый раз, когда я пытаюсь запустить bundle install
, я получаю ошибку Bundler::HTTPError Could not fetch specs from https://rubygems.org
. Я на macOS 10.13, ruby 2.5.1.
Вот мой вывод ruby -ropen-uri -e 'eval open("https://git.io/vQhWq").read'
Here's your Ruby and OpenSSL environment:
Ruby: 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
RubyGems: 2.7.7
Bundler: 1.16.2
Compiled with: OpenSSL 1.0.2o 27 Mar 2018
Loaded version: OpenSSL 1.0.2o 27 Mar 2018
SSL_CERT_FILE: /usr/local/etc/openssl/cert.pem
SSL_CERT_DIR: /usr/local/etc/openssl/certs
With that out of the way, let's see if you can connect to rubygems.org...
Bundler connection to rubygems.org: failed ❌ (execution expired)
RubyGems connection to rubygems.org: failed ❌ (timed out (https://rubygems.org))
Ruby net/http connection to rubygems.org: failed ❌
Unfortunately, this Ruby can't connect to rubygems.org. ?
Even worse, we're not sure why. ?
Here's the full error information:
Net::OpenTimeout: execution expired
/usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/net/http.rb:937:in `initialize'
/usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/net/http.rb:937:in `open'
/usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/net/http.rb:937:in `block in connect'
/usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/timeout.rb:103:in `timeout'
/usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/net/http.rb:935:in `connect'
/usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/net/http.rb:920:in `do_start'
/usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/net/http.rb:915:in `start'
(eval):90:in `<main>'
-e:1:in `eval'
-e:1:in `<main>'
You might have more luck using Mislav's SSL doctor.rb script. You can get it here:
https://github.com/mislav/ssl-tools/blob/8b3dec4/doctor.rb
Read more about the script and how to use it in this blog post:
https://mislav.net/2013/07/ruby-openssl/
Запустив вышеупомянутый скрипт, я получаю:
/usr/local/Cellar/ruby/2.5.1/bin/ruby (2.5.1-p57)
OpenSSL 1.0.2o 27 Mar 2018: /usr/local/etc/openssl
SSL_CERT_DIR=""
SSL_CERT_FILE=""
HEAD https://status.github.com:443
#<Net::HTTPGatewayTimeOut 504 GATEWAY_TIMEOUT readbody=true>
И, наконец, openssl s_client -connect rubygems.org:443 -tls1
показывает:
CONNECTED(00000005)
140735672206280:error:1409442E:SSL routines:SSL3_READ_BYTES:tlsv1 alert protocol version:/BuildRoot/Library/Caches/com.apple.xbs/Sources/libressl/libressl-22.50.2/libressl/ssl/s3_pkt.c:1133:SSL alert number 70
140735672206280:error:1409E0E5:SSL routines:SSL3_WRITE_BYTES:ssl handshake failure:/BuildRoot/Library/Caches/com.apple.xbs/Sources/libressl/libressl-22.50.2/libressl/ssl/s3_pkt.c:522:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 7 bytes and written 0 bytes
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol : TLSv1
Cipher : 0000
Session-ID:
Session-ID-ctx:
Master-Key:
Start Time: 1530836427
Timeout : 7200 (sec)
Verify return code: 0 (ok)
---
Я знаю, что проблема связана с моим сертификатом SSL, но я обновил openssl, и ruby -ropenssl -e "puts OpenSSL::SSL::SSLContext::METHODS.grep(/.+\d$/).sort"
показывает, что у меня есть TLSv1_2
, поэтому я не знаю, почему он не работает.
Я ломал голову над этим уже несколько дней - любая помощь будет признательна! Спасибо!
ОБНОВЛЕНИЕ: Прошло не несколько недель, и эта проблема постоянно исчезает и возвращается. На днях я перезапустил свой Mac, и все работало нормально. Сегодня я получил совершенно новую ошибку:
$ ruby -ropen-uri -e 'eval
open("https://git.io/vQhWq").read'
Here's your Ruby and OpenSSL environment:
Ruby: 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
RubyGems: 2.7.7
Bundler: 1.16.2
Compiled with: OpenSSL 1.0.2o 27 Mar 2018
Loaded version: OpenSSL 1.0.2o 27 Mar 2018
SSL_CERT_FILE: /usr/local/etc/openssl/cert.pem
SSL_CERT_DIR: /usr/local/etc/openssl/certs
With that out of the way, let's see if you can connect to rubygems.org...
Bundler connection to rubygems.org: failed ❌ (execution expired)
RubyGems connection to rubygems.org: success ✅
Ruby net/http connection to rubygems.org: success ✅
Although your Ruby installation and RubyGems can both connect to rubygems.org, Bundler is having trouble. The most likely way to fix this is to upgrade Bundler by running `gem install bundler`. Run this script again after doing that to make sure everything is all set. If you're still having trouble, check out the troubleshooting guide at http://ruby.to/ssl-check-failed ?
(eval):136: warning: constant OpenSSL::SSL::SSLContext::METHODS is deprecated
Затем я следовал инструкциям, запустил $ gem install bundler
и получил:
ERROR: Could not find a valid gem 'bundler' (>= 0) in any repository
Что происходит?