Reputation: 142
This has been driving me nuts - I've looked everywhere for a solution to this over the last three days... but nothing's worked, so far.
On Monday, I was getting this error when trying to install 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)
So figured it was a firewall / proxy error. To try and get around it, I used the --http-proxy
option:
C:\Ruby24-x64\bin>gem install watir --http-proxy http://my.awesome.proxy:port
ERROR: While executing gem ... (Net::HTTPServerException)
407 "Proxy Authentication Required"
So then I tried running it with my username and password defined, but I've read it won't work if my password contains a special character (which it does):
C:\Ruby24-x64\bin>gem install --http-proxy http://myusername:[email protected]:port watir
ERROR: While executing gem ... (Net::HTTPServerException)
407 "Proxy Authentication Required"
So then I tried set the proxy, username and password for HTTP and HTTPS using the set option like so:
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 I'm still getting the 407 error. Any ideas?
I'm on Windows 10, my gem environment details are below:
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
Upvotes: 1
Views: 2023
Reputation: 142
Finally solved it! A colleague had similar proxy issues with Atom's plugin list so pointed me in the right direction.
The command is:
gem install --http-proxy http://{domain}%5C{username}:{password}@{proxy.address}:{port}/ watir
Upvotes: 2