[RUBY] Error in bundle install when running rails new

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/

Cause: Because I was using free wi-fi at a certain cafe

It seems that the cause of this error is often caused by using Free wi-fi or OfficeScan.

Solution: There are 3 steps

STEP1: Upgrade the version of RubyGems (gem command) itself
% gem update –system
% bundle install

If this still doesn't work, go to the next

STEP2: Manually link with the library

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

STEP3: Change the wi-fi environment or stop OfficeScan Let's give up working with free wi-fi this time. Go back to your home or work and try bundle install again. As for how to stop OfficeScan, it changes for each software, so check the site etc. and execute it.

Recommended Posts

Error in bundle install when running rails new
Error when bundle install
Error summary in bundle install. memorandum
bundle install error
bundle install error
I don't see an error in Rails bundle install ... the solution
[Rails] Solution when migration error occurs in acts-as-taggable-on
Mac Rails Install Error
Resolve Gem :: FilePermissionError when running gem install rails (Rails Tutorial Chapter 1)
Error in rails db: migrate
Error when using rails capybara
Resolve CreateProcess error = 206 when running Java in a Windows environment
Show detailed error in Logger when running Java on server
Error when npm install on Windows 7
Rails new fails to install mysql
[Rails] Unexpected validation error in devise
Create a new app in Rails
[Rails 6] MySQL 2 cannot be bundle install
How to install Swiper in Rails
Symbol not found error when new class in another Java file
Remedy for "A server is already running." Error when running rails s
Breakpoint doesn't work when running Rails Minitest in Ruby Test Explorer
[Environment construction] Error when bundle install Errno :: EACCES: Permission denied @ dir_s_mkdir-
I want to add devise in Rails, but I can't bundle install
Install Rails in the development environment and create a new application
What to do and how to install when an error occurs in DXRuby 1.4.7
Error in implementation when implementing Spring validation
What to do if an error occurs when nokogiri enters when bundle install
When building rails6 environment on Ubuntu, it gets stuck with bundle install
Solution when you get the error Webpacker :: Manifest :: MissingEntryError in Devise :: Sessions # new
Dealing with NameError: uninitialized constant :: Analyzable error when installing Active Storage in Rails6
Error when running git push heroku master on Heroku
[Rails] Could not locate Gemfile with bundle install
[Rails] Error resolution when generating tokens with PAYJP
Unable to connect to chromedriver error when running SystemSpec
Rails new in Ruby on Rails ~ Memorandum until deployment 2
Error with bundle install after upgrading to Catalina
Rails <% = expression%> Why no error occurs when empty
500 Internal Server Error occurs in Rails production environment
Rails new in Ruby on Rails ~ Memorandum until deployment 1
[No Method Error] Solution when new action occurs
[Ruby on Rails] How to install Bootstrap in Rails
[Rails] ActiveRecord :: HasManyThrough Order Error in Users # show
Simple notification function in Rails (only when followed)
[In team development] Error when moving to another member's branch and doing rails s [Rails]
Ruby on Rails Incorrect string value error resolution when posting a form in Japanese
Group_by in Rails
composer install error
One case of solving a migration error in Rails
[Ruby on Rails Tutorial] Error in the test in Chapter 3
Points stuck when running vite + Nginx in Docker environment
Bundle install with docker + rails6 does not reflect gem
[Rails] About error resolution when installing devise and activeadmin
Error encountered with notes when deploying docker on rails
[Rails] "private method` String' called ~ "error when db: migrate
Migration error after Activerecord association in Rails5 + Docker environment
Regarding overcapacity when setting Rails tutorial environment in Cloud 9
About the error caused by bundle install ~ puma Gem ~
Dramatically speed up slow bundle install in docker environment
Ruby on Rails Tutorial Troublesome notes when running on Windows
Syntax error when including HTML tags in Draper + create.js.erb