Bundle install is not working
Solution 1
It's a connectivity issue.
I solved it through hideMe VPN. It is used to bypass blocked websites or for servers down only for a particular user.
Now everything seems to work just fine.
Solution 2
Open the Gemfile and change first line from this
source 'https://www.rubygems.org'
to this
source 'http://www.rubygems.org'
remove the 's
' from 'https
'.
Solution 3
As @Wasif mentioned, first make sure the Ruby Gems site is up and your network access is ok.
If they works fine, try it like this:
First, delete your
Gemfile.lock
fileThen run
gem update --system
Then in your Gemfile try changing the first line
source 'https://rubygems.org'
tohttp://
(without ans
)
Unless there is a problem with your connectivity this should fix the issue with bundle install
.
Solution 4
I resolve this issue disabling the IPv6 connections in my system OS. It forces the OS just use the IPv4 and then it works.
If your active network is WiFi enter the following command:
networksetup -setv6off Wi-Fi
If you are on Ethernet:
networksetup -setv6off Ethernet
You may combine both of commands to disable IPv6 on WiFi and Ethernet at the same time:
networksetup -setv6off Ethernet && networksetup -setv6off Wi-Fi
To re-enable IPv6, you need to replace setv6off to setv6automatic (the default state in macOS), for example:
networksetup -setv6automatic Wi-Fi && networksetup -setv6automatic Ethernet
reference: https://vladtalks.tech/vpn/how-to-disable-ipv6-on-mac
Solution 5
While gem is stalling, I ran netstat
netstat -tnp | grep ruby
and I got below output
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp6 0 1 2401:4900:188e:90:56960 2a04:4e42:600::644:443 SYN_SENT 4096/ruby
and 2a04:4e42:600::644:443 is one of the addresses of api.rubygems.org
My conclusion is that gem uses IPv6 when it can.
So disabling IPV6 on my workstation fixed it.
Below are the steps to temporarily disabled IPV6 on Ubuntu. IPV6 will be enabled after system restart.
sysctl -w net.ipv6.conf.all.disable_ipv6=1
sysctl -w net.ipv6.conf.default.disable_ipv6=1
Note: Use sudo for permission denied
issue.
ruby1141
Updated on August 16, 2021Comments
-
ruby1141 over 2 years
I'm developing Ruby on Rails on Windows.
Something went wrong with our local network and can't access https://www.rubygems.org, seems like it is blocked or something.
But I can access it through http://www.proxyfoxy.com.
Below is the result of
bundle install
:$ bundle install
Fetching source index from https://rubygems.org/
Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from https://rubygems.org/
Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from https://rubygems.org/
Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from https://rubygems.org/
Could not fetch specs from https://rubygems.org/
Is there any other way to install gems through
bundle install
? -
ruby1141 almost 8 yearsIt's a connectivity issue.I solved it through hideMe VPN. it is used to bypass blocked websites or for servers down only for a particular user.
-
Captain Man over 6 years@soorapadman this isn't a link only answer. Please read it more thoroughly. ACHYUT KADAM is suggesting to change the line
source 'https://www.rubygems.org'
. -
soorapadman over 6 years@CaptainMan my bad apologies.
-
Nick about 3 yearsPlease don't add the same answer to multiple questions. Answer the best one and flag the rest as duplicates. See Is it acceptable to add a duplicate answer to several questions?
-
Kobato about 2 yearsWell, I had a similar issue with Ruby 1.9.3 (required due to a certain system), and this actually worked. It complained a lot about MITM etc, but it did work