As the title says, when I run rails new, I get the following error ...
Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from https://rubygems.org/ Could not fetch specs from https://rubygems.org/
It seems that the cause of this error is often caused by using Free wi-fi or OfficeScan.
% gem update –system
% bundle install
If this still doesn't work, go to the next
If you can't solve it even in step 1, you may not be able to link with other libraries automatically, so you need to set the path to rubygems.org manually.
What is __rubygems.org? __ This is the site that manages the Ruby library. Here is the site URL https://rubygems.org/ You can also check what kind of gems you have, so please refer to it when you have time.
When bundle install is executed, the contents described in the Gemfile are automatically passed through the path to rubygems.org, but if the security is robust, this will be blocked and an error will occur.
Follow the steps below.
__Check the rubygems api __
% host api.rubygems.org
When the above command is executed, the following contents will be displayed.
------------from here------------ rubygems.org has address XXX.XXX.XXX.XX rubygems.org has address XXX.XXX.XXX.XX rubygems.org has address XXX.XXX.XXX.XX rubygems.org has address XXX.XXX.XXX.XX -----------Use up to here----------- rubygems.org has IPv6 address 2a04:4e42::70 rubygems.org mail is handled by 10 mxa.mailgun.org. rubygems.org mail is handled by 10 mxb.mailgun.org.
I think that the part of XXX.XXX.XXX.XX is the part of api and various numbers are lined up, but I will use this part.
__IPv6 is, roughly speaking, a 128-bit representation of an IP address. __ ↓ Please refer to this site. https://dream.jp/ftth/tips_f/hikari17.html
__ Use the above api to pass the path __ Open the following file
% sudo vim /etc/hosts
Since we will go through the path from here, copy one of the above XXX.XXX.XXX.XX (api) and add it as follows
XXX.XXX.XXX.XXX rubygems.org XXX.XXX.XXX.XXX rubygems.org XXX.XXX.XXX.XXX rubygems.org XXX.XXX.XXX.XXX rubygems.org
Then try bundle install and if that doesn't work ...