Bundle install is not working

2020-08-21 04:31发布

问题:

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?

回答1:

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



回答2:

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.



回答3:

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



回答4:

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



回答5:

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



回答6:

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.



回答7:

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.



回答8:

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.



回答9:

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



回答10:

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.