问题
I am failing to install bundler
. I am on Ubuntu 18 and have ruby 2.5.1 installed. Here is the output of running this command.
gem install bundler --debug
NOTE: Debugging mode prints all exceptions even when rescued
Exception `LoadError' at /home/ikushlianski/.rbenv/versions/2.5.1/lib/ruby/2.5.0/resolv.rb:170 - LoadError
Exception `Net::OpenTimeout' at /home/ikushlianski/.rbenv/versions/2.5.1/lib/ruby/2.5.0/net/http.rb:937 - execution expired
Exception `Net::OpenTimeout' at /home/ikushlianski/.rbenv/versions/2.5.1/lib/ruby/2.5.0/net/http.rb:939 - execution expired
Exception `Net::OpenTimeout' at /home/ikushlianski/.rbenv/versions/2.5.1/lib/ruby/2.5.0/timeout.rb:114 - execution expired
Exception `Net::OpenTimeout' at /home/ikushlianski/.rbenv/versions/2.5.1/lib/ruby/2.5.0/net/http.rb:997 - execution expired
Exception `Gem::RemoteFetcher::UnknownHostError' at /home/ikushlianski/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems/remote_fetcher.rb:306 - timed out (https://api.rubygems.org/api/v1/dependencies)
Exception `Errno::EEXIST' at /home/ikushlianski/.rbenv/versions/2.5.1/lib/ruby/2.5.0/fileutils.rb:232 - File exists @ dir_s_mkdir - /home/ikushlianski/.gem/specs/api.rubygems.org%443
Exception `Errno::ENOENT' at /home/ikushlianski/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems/remote_fetcher.rb:325 - No such file or directory @ rb_file_s_stat - /home/ikushlianski/.gem/specs/api.rubygems.org%443/prerelease_specs.4.8
Exception `Net::OpenTimeout' at /home/ikushlianski/.rbenv/versions/2.5.1/lib/ruby/2.5.0/net/http.rb:937 - execution expired
Exception `Net::OpenTimeout' at /home/ikushlianski/.rbenv/versions/2.5.1/lib/ruby/2.5.0/net/http.rb:939 - execution expired
Exception `Net::OpenTimeout' at /home/ikushlianski/.rbenv/versions/2.5.1/lib/ruby/2.5.0/timeout.rb:114 - execution expired
Exception `Net::OpenTimeout' at /home/ikushlianski/.rbenv/versions/2.5.1/lib/ruby/2.5.0/net/http.rb:997 - execution expired
Exception `Gem::RemoteFetcher::UnknownHostError' at /home/ikushlianski/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems/remote_fetcher.rb:306 - timed out (https://api.rubygems.org/prerelease_specs.4.8.gz)
Exception `Errno::EEXIST' at /home/ikushlianski/.rbenv/versions/2.5.1/lib/ruby/2.5.0/fileutils.rb:232 - File exists @ dir_s_mkdir - /home/ikushlianski/.gem/specs/api.rubygems.org%443
Exception `Errno::ENOENT' at /home/ikushlianski/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems/remote_fetcher.rb:325 - No such file or directory @ rb_file_s_stat - /home/ikushlianski/.gem/specs/api.rubygems.org%443/specs.4.8
Exception `Net::OpenTimeout' at /home/ikushlianski/.rbenv/versions/2.5.1/lib/ruby/2.5.0/net/http.rb:937 - execution expired
Exception `Net::OpenTimeout' at /home/ikushlianski/.rbenv/versions/2.5.1/lib/ruby/2.5.0/net/http.rb:939 - execution expired
Exception `Net::OpenTimeout' at /home/ikushlianski/.rbenv/versions/2.5.1/lib/ruby/2.5.0/timeout.rb:114 - execution expired
Exception `Net::OpenTimeout' at /home/ikushlianski/.rbenv/versions/2.5.1/lib/ruby/2.5.0/net/http.rb:997 - execution expired
Exception `Gem::RemoteFetcher::UnknownHostError' at /home/ikushlianski/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems/remote_fetcher.rb:306 - timed out (https://api.rubygems.org/specs.4.8.gz)
Exception `Gem::RemoteFetcher::UnknownHostError' at /home/ikushlianski/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems/spec_fetcher.rb:269 - timed out (https://api.rubygems.org/specs.4.8.gz)
Exception `Gem::UnsatisfiableDependencyError' at /home/ikushlianski/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems/resolver/installer_set.rb:72 - Unable to resolve dependency: user requested 'bundler (>= 0)'
ERROR: Could not find a valid gem 'bundler' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - timed out (https://api.rubygems.org/specs.4.8.gz)
Exception `Errno::EEXIST' at /home/ikushlianski/.rbenv/versions/2.5.1/lib/ruby/2.5.0/fileutils.rb:232 - File exists @ dir_s_mkdir - /home/ikushlianski/.gem/specs/api.rubygems.org%443
Exception `Errno::ENOENT' at /home/ikushlianski/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems/remote_fetcher.rb:325 - No such file or directory @ rb_file_s_stat - /home/ikushlianski/.gem/specs/api.rubygems.org%443/latest_specs.4.8
Running sudo gem install bundler
outputs sudo: gem: command not found
回答1:
Try disabling IPv6 on your Ubuntu
来源:https://stackoverflow.com/questions/52442766/gem-install-error-timed-out-https-api-rubygems-org