12
votes

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?

13
seems like it's your network issue rather than rubygems.orgWasif Hossain
let us know if you can visit other websites in natural way without any proxyWasif Hossain
visit here (isitup.org/rubygems.org) to make sure the issue is localWasif Hossain

13 Answers

8
votes

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'.

4
votes

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 file

  • Then run gem update --system

  • Then in your Gemfile try changing the first line source 'https://rubygems.org'to http:// (without an s)

Unless there is a problem with your connectivity this should fix the issue with bundle install.

1
votes

I had the same issue and it happened to work when I shutdown the rails server before running bundle install

1
votes

Sometimes, Your DNS cause this problem.

You can change your DNS to 1.1.1.1 or 8.8.8.8

Instructions for mac

  • Go to preferences panel
  • Click on network panel
  • Click to advanced button
  • Go to DNS tab
  • Add DNS server (with '+' button)
  • Enter 1.1.1.1 OR 8.8.8.8
  • Click to Ok
  • And click to apply

But you can follow these steps: http://www.macinstruct.com/node/434

Instructions for windows

https://www.windowscentral.com/how-change-your-pcs-dns-settings-windows-10

1
votes

I faced the same issue but on Ubuntu, what helped was running:

env | grep proxy

which showed some active proxies like these:

https_proxy=127.0.0.1:8888
http_proxy=127.0.0.1:8888

After I removed each of them with the unset command:

unset https_proxy
unset http_proxy

I could run bundle install normally.

1
votes

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.

0
votes

In your Gemfile from the first line the source should be http:// instead of https://

change

sourçe  https://www.rubygems.org into

source  http://www.rubygems.org

Then you can run bundle install successfully

0
votes

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.

0
votes

I was getting the same error when running bundle in a rails app. I solve the problem by running:

$ bin/bundle

Problem was that bundle was v1.17.3, while bin/bundle was version 2.0.2.

0
votes

This mistake was very difficult for me. I was a day without being able to solve it but finally I turned off my wifi router and waited 1 minute to turn it on again. Then the error was fixed, hope it helps.

0
votes

It is just a network issue.

follwoing things can help you to solve this problem -:

  1. forget the network and reconnect it.
  2. Turn on aeroplane mode of your mobile and again turn off it if you connected with mobile hotspot
0
votes

Someone might find this useful: I had this error message when building a docker image and it turned out I had some custom dns settings in /etc/docker/daemon.json

-1
votes

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