我在添加gem源时遇到ResolveTimeout异常。这是什么意思?
以下是gem env
:
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.5
- RUBY VERSION: 2.2.2 (2015-04-13 patchlevel 95) [x86_64-darwin14]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.2.0
- RUBY EXECUTABLE: /usr/local/opt/ruby/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/bin
- SPEC CACHE DIRECTORY: /Users/NSDont/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /usr/local/Cellar/ruby/2.2.2/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-14
- GEM PATHS:
- /usr/local/lib/ruby/gems/2.2.0
- /Users/NSDont/.gem/ruby/2.2.0
- /usr/local/Cellar/ruby/2.2.2/lib/ruby/gems/2.2.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- :sources => []
- REMOTE SOURCES:
- SHELL PATH:
- /Users/NSDont/.rvm/bin
- node_modules/.bin
- /Users/NSDont/bin
- /usr/local/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /usr/bin
- /bin
- /usr/local/sbin
- /usr/sbin
- /sbin
以下是gem source
:
*** CURRENT SOURCES ***
如你所见,我没有任何消息来源。但是当我尝试添加一个时:
gem sources -a http://mirrors.aliyun.com/rubygems/ -V --debug
我收到一个ResolvTimeout异常:
NOTE: Debugging mode prints all exceptions even when rescued
Exception `LoadError' at /usr/local/Cellar/ruby/2.2.2/lib/ruby/2.2.0/resolv.rb:168 - LoadError
Exception `Resolv::ResolvTimeout' at /usr/local/Cellar/ruby/2.2.2/lib/ruby/2.2.0/resolv.rb:687 - Resolv::ResolvTimeout
Exception `Resolv::ResolvTimeout' at /usr/local/Cellar/ruby/2.2.2/lib/ruby/2.2.0/resolv.rb:687 - Resolv::ResolvTimeout
Exception `Resolv::ResolvTimeout' at /usr/local/Cellar/ruby/2.2.2/lib/ruby/2.2.0/resolv.rb:687 - Resolv::ResolvTimeout
Exception `Resolv::ResolvTimeout' at /usr/local/Cellar/ruby/2.2.2/lib/ruby/2.2.0/resolv.rb:687 - Resolv::ResolvTimeout
Exception `Resolv::ResolvTimeout' at /usr/local/Cellar/ruby/2.2.2/lib/ruby/2.2.0/resolv.rb:687 - Resolv::ResolvTimeout
Exception `Resolv::ResolvTimeout' at /usr/local/Cellar/ruby/2.2.2/lib/ruby/2.2.0/resolv.rb:687 - Resolv::ResolvTimeout
ResolvEimtout例外是什么意思?
运行gem sources --add https://rubygems.org -V --debug
仍有错误:
NOTE: Debugging mode prints all exceptions even when rescued
Exception `LoadError' at /usr/local/Cellar/ruby/2.2.2/lib/ruby/2.2.0/resolv.rb:168 - LoadError
Exception `Errno::EEXIST' at /usr/local/Cellar/ruby/2.2.2/lib/ruby/2.2.0/fileutils.rb:252 - File exists @ dir_s_mkdir - /Users/NSDont/.gem/specs/api.rubygems.org%443
Exception `Errno::ENOENT' at /usr/local/Cellar/ruby/2.2.2/lib/ruby/2.2.0/rubygems/remote_fetcher.rb:300 - No such file or directory @ rb_file_s_stat - /Users/NSDont/.gem/specs/api.rubygems.org%443/specs.4.8
GET https://api.rubygems.org/specs.4.8.gz
Exception `OpenSSL::SSL::SSLErrorWaitReadable' at /usr/local/Cellar/ruby/2.2.2/lib/ruby/2.2.0/openssl/buffering.rb:182 - read would block
302 Moved Temporarily
GET https://s3.amazonaws.com/production.s3.rubygems.org/specs.4.8.gz
Exception `OpenSSL::SSL::SSLErrorWaitReadable' at /usr/local/Cellar/ruby/2.2.2/lib/ruby/2.2.0/openssl/buffering.rb:182 - read would block
Exception `OpenSSL::SSL::SSLErrorWaitReadable' at /usr/local/Cellar/ruby/2.2.2/lib/ruby/2.2.0/openssl/buffering.rb:182 - read would block
Exception `OpenSSL::SSL::SSLErrorWaitReadable' at /usr/local/Cellar/ruby/2.2.2/lib/ruby/2.2.0/openssl/buffering.rb:182 - read would block
Exception `OpenSSL::SSL::SSLErrorWaitReadable' at /usr/local/Cellar/ruby/2.2.2/lib/ruby/2.2.0/openssl/buffering.rb:182 - read would block
答案 0 :(得分:0)
您可以使用此命令
设置gem source
$ gem sources --add https://rubygems.org