bil*_*man 4 ruby openssl rubygems bundler
我已经在 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:\n\nRuby: 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]\nRubyGems: 2.7.7\nBundler: 1.16.2\nCompiled with: OpenSSL 1.0.2o 27 Mar 2018\nLoaded version: OpenSSL 1.0.2o 27 Mar 2018\nSSL_CERT_FILE: /usr/local/etc/openssl/cert.pem\nSSL_CERT_DIR: /usr/local/etc/openssl/certs\n\nWith that out of the way, let\'s see if you can connect to rubygems.org...\n\nBundler connection to rubygems.org: failed \xe2\x9d\x8c (execution expired)\nRubyGems connection to rubygems.org: failed \xe2\x9d\x8c (timed out (https://rubygems.org))\nRuby net/http connection to rubygems.org: failed \xe2\x9d\x8c\n\nUnfortunately, this Ruby can\'t connect to rubygems.org. \nEven worse, we\'re not sure why. \n\nHere\'s the full error information:\nNet::OpenTimeout: execution expired\n /usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/net/http.rb:937:in `initialize\'\n /usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/net/http.rb:937:in `open\'\n /usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/net/http.rb:937:in `block in connect\'\n /usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/timeout.rb:103:in `timeout\'\n /usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/net/http.rb:935:in `connect\'\n /usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/net/http.rb:920:in `do_start\'\n /usr/local/Cellar/ruby/2.5.1/lib/ruby/2.5.0/net/http.rb:915:in `start\'\n (eval):90:in `<main>\'\n -e:1:in `eval\'\n -e:1:in `<main>\'\n\nYou might have more luck using Mislav\'s SSL doctor.rb script. You can get it here:\nhttps://github.com/mislav/ssl-tools/blob/8b3dec4/doctor.rb\nRead more about the script and how to use it in this blog post:\nhttps://mislav.net/2013/07/ruby-openssl/\nRun Code Online (Sandbox Code Playgroud)\n\n运行上述脚本,我得到:
\n\n/usr/local/Cellar/ruby/2.5.1/bin/ruby (2.5.1-p57)\nOpenSSL 1.0.2o 27 Mar 2018: /usr/local/etc/openssl\nSSL_CERT_DIR=""\nSSL_CERT_FILE=""\n\nHEAD https://status.github.com:443\n#<Net::HTTPGatewayTimeOut 504 GATEWAY_TIMEOUT readbody=true>\nRun Code Online (Sandbox Code Playgroud)\n\n最后,openssl s_client -connect rubygems.org:443 -tls1显示:
CONNECTED(00000005)\n140735672206280: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\n140735672206280: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:\n---\nno peer certificate available\n---\nNo client certificate CA names sent\n---\nSSL handshake has read 7 bytes and written 0 bytes\n---\nNew, (NONE), Cipher is (NONE)\nSecure Renegotiation IS NOT supported\nCompression: NONE\nExpansion: NONE\nNo ALPN negotiated\nSSL-Session:\n Protocol : TLSv1\n Cipher : 0000\n Session-ID: \n Session-ID-ctx: \n Master-Key: \n Start Time: 1530836427\n Timeout : 7200 (sec)\n Verify return code: 0 (ok)\n---\nRun Code Online (Sandbox Code Playgroud)\n\n我知道问题与我的 SSL 证书有关,但我已经更新了 openssl 并ruby -ropenssl -e "puts OpenSSL::SSL::SSLContext::METHODS.grep(/.+\\d$/).sort"表明我确实有TLSv1_2,所以我不知道为什么它不起作用。
我已经为此绞尽脑汁好几天了 - 任何帮助将不胜感激!谢谢!
\n\n更新:还不到几周,这个问题就不断消失并再次出现。有一天,我重新启动了 Mac,一切正常。今天我遇到了一个全新的错误:
\n\n$ ruby -ropen-uri -e \'eval \n\nopen("https://git.io/vQhWq").read\'\nHere\'s your Ruby and OpenSSL environment:\n\nRuby: 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]\nRubyGems: 2.7.7\nBundler: 1.16.2\nCompiled with: OpenSSL 1.0.2o 27 Mar 2018\nLoaded version: OpenSSL 1.0.2o 27 Mar 2018\nSSL_CERT_FILE: /usr/local/etc/openssl/cert.pem\nSSL_CERT_DIR: /usr/local/etc/openssl/certs\n\nWith that out of the way, let\'s see if you can connect to rubygems.org...\n\nBundler connection to rubygems.org: failed \xe2\x9d\x8c (execution expired)\nRubyGems connection to rubygems.org: success \xe2\x9c\x85\nRuby net/http connection to rubygems.org: success \xe2\x9c\x85\n\nAlthough 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 \n(eval):136: warning: constant OpenSSL::SSL::SSLContext::METHODS is deprecated\nRun Code Online (Sandbox Code Playgroud)\n\n然后我按照说明运行,$ gem install bundler并得到:
ERROR: Could not find a valid gem \'bundler\' (>= 0) in any repository\nRun Code Online (Sandbox Code Playgroud)\n\n到底是怎么回事?
\n对于 Mac OS,更改为以下配置即可。
系统偏好设置 > 网络 > 高级 > TCP/IP > 配置 IPv6:仅限本地链路
更多信息:https://rob.co.bb/posts/2018-10-22-yak-shave-gem-install-issue/
| 归档时间: |
|
| 查看次数: |
6153 次 |
| 最近记录: |