这让我抓狂--在过去的三天里我到处寻找解决这个问题的方法.但到目前为止什么都没起作用。
星期一,当我试图安装watir时,我收到了这个错误:
C:\Users\dan>gem install watir
ERROR: Could not find a valid gem 'watir' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - timed out
(https://api.rubygems.org/specs.4.8.gz)
所以认为这是防火墙/代理错误。为了避免这种情况,我使用了--http-proxy
选项:
C:\Ruby24-x64\bin>gem install watir --http-proxy http://my.awesome.proxy:port
ERROR: While executing gem ... (Net::HTTPServerException)
407 "Proxy Authentication Required"
因此,我尝试用我的用户名和密码来运行它,但是如果我的密码包含一个特殊字符(它确实包含),那么它就不能工作了:
C:\Ruby24-x64\bin>gem install --http-proxy http://myusername:mypassword@my.awesome.proxy:port watir
ERROR: While executing gem ... (Net::HTTPServerException)
407 "Proxy Authentication Required"
因此,我尝试使用set选项设置HTTP和HTTPS的代理、用户名和密码,如下所示:
set HTTP_PROXY=my.awesome.proxy:port
set HTTP_PROXY_USER=myusername
set HTTP_PROXY_PASS=mypassword
set HTTPS_PROXY=my.awesome.proxy:port
set HTTPS_PROXY_USER=myusername
set HTTPS_PROXY_PASS=mypassword
...but,我仍然得到407错误。有什么想法吗?
我在Windows 10上,我的gem环境详细信息如下:
C:\Ruby24-x64\bin>gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.7.2
- RUBY VERSION: 2.4.2 (2017-09-14 patchlevel 198) [x64-mingw32]
- INSTALLATION DIRECTORY: C:/Ruby24-x64/lib/ruby/gems/2.4.0
- USER INSTALLATION DIRECTORY: C:/Users/dan/.gem/ruby/2.4.0
- RUBY EXECUTABLE: C:/Ruby24-x64/bin/ruby.exe
- EXECUTABLE DIRECTORY: C:/Ruby24-x64/bin
- SPEC CACHE DIRECTORY: C:/Users/dan/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: C:/ProgramData
- RUBYGEMS PLATFORMS:
- ruby
- x64-mingw32
- GEM PATHS:
- C:/Ruby24-x64/lib/ruby/gems/2.4.0
- C:/Users/dan/.gem/ruby/2.4.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
@Beartech:
C:\Ruby24-x64>ruby -ropenssl -e 'puts OpenSSL::OPENSSL_VERSION'
OpenSSL 1.0.2l 25 May 2017
MINGW64 ~
$ openssl s_client -host rubygems.org -port 443
connect: Connection timed out
connect:errno=116
发布于 2017-11-29 08:04:31
终于解决了!一位同事对Atom的插件列表也有类似的代理问题,所以我指出了正确的方向。
该命令是:
gem install --http-proxy http://{domain}%5C{username}:{password}@{proxy.address}:{port}/ watir
https://stackoverflow.com/questions/47433738
复制相似问题