16

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?

3
  • seems like it's your network issue rather than rubygems.org Jul 16, 2016 at 11:20
  • let us know if you can visit other websites in natural way without any proxy Jul 16, 2016 at 11:22
  • 2
    visit here (isitup.org/rubygems.org) to make sure the issue is local Jul 16, 2016 at 11:27

13 Answers 13

13

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

3
  • 2
    @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'. Nov 20, 2017 at 13:51
  • 1
    @CaptainMan my bad apologies. Nov 20, 2017 at 14:01
  • Well, 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
    – Kobato
    Mar 29, 2022 at 14:23
8

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
  • 2
    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.
    – ruby1141
    Jul 20, 2016 at 6:25
1

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

1

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

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

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.

1
0

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

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

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

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

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

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

-2

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

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.