When creating an app with the new command in Ruby on Rails bundler: failed to load command: spring (/ Users/user name/directory name to create the app/app name/vendor/bundle/ruby ​​/ 2.6.0/bin/spring )

Good evening. My name is Miyayan. This is my first article on Qiita. Therefore, I think that there are some parts that are not good, but thank you for your cooperation.

table of contents

--Environment --Reference article

environment

OS : macOS Big Sur ver.11.1 Ruby : 2.6.5p114 Rails : 6.0.0 bundler : 2.1.4, default: 1.17.2 gem : 3.0.3

Reference article

-[Rails6] rails new got bundler: failed to load command: spring. The problem seems to be with bundler 2.1.4 or Ruby 2.7 .....

-Bundler: failed to load command: spring is issued. ..

-Difference between "gem update --system" and "gem update"

Overview

I tried to create an application using the new command on rails.

rails _6.0.0_new app name-d mysql

Then, the following text will be displayed in red!

bundler: failed to load command: spring (/Users/username/The directory where you want to create the app/app name/vendor/bundle/ruby/2.6.0/bin/spring)

Do you say that it seems to be an error and not an error? To be honest, I'm a beginner in programming, so I'm not sure what's going on ... However, just the red letters make me sick. Is it possible to create an application without the text like this warning somehow?

hypothesis

From the point of view of the text, I feel that Spring is not working well. However, if you look at the installed Gem,

Installing spring 2.1.1

Is displayed in green, and Spring is included. To be honest, I feel that this warning can be ignored. Looking at the reference article, it is written that the bundler whose version is 2.1.4 is doing something wrong.

So let's play with bundler.

What I tried

First, let's check the version of bundler.

% gem list bundler

*** LOCAL GEMS ***

bundler (2.1.4, default: 1.17.2)

It is 2.1.4, which is the same as the reference articles. Uninstall this and check the version again.

% gem uninstall bundler
Successfully uninstalled bundler-2.1.4

% gem list bundler     

*** LOCAL GEMS ***

bundler (default: 1.17.2)

And then I'll add the latest version of bundler.

% gem install bundler

Let's check the bundler version again here.

% gem list bundler   

*** LOCAL GEMS ***

bundler (2.2.3, default: 1.17.2)

bundler has been upgraded to 2.2.3. Now let's create an app with the new command! !! !!

bundler: failed to load command: spring (/Users/username/The directory where you want to create the app/app name/vendor/bundle/ruby/2.6.0/bin/spring)

** Will it come out! !! !! ** Apparently not a bundler. Or even 2.2.3 may have a Spring warning.

** The version of the gem itself ...? ** **

Solutions

This is the solution in my case. We would appreciate it if you could use it as a reference only.

Check the version of gem.

% gem -v
3.0.3

Try to update the gem.

% gem update --system

Check the gem version again.

% gem -v             
3.2.3

It seems that the update is complete. I was skeptical that this would solve the problem, but I will check the bundler version here as well.

% gem list bundler

*** LOCAL GEMS ***

bundler (default: 2.2.3)

**Hmm? ** The notation is a little different. Earlier

bundler (2.2.3, default: 1.17.2)

It seems that this kind of display is the latest version of bundler's default by updating the gem itself.

If you create the app again with the rails new command here, ** The creation was completed without any warning! !! !! **

Summary

In conclusion, I'm not sure why it was solved, (1) It was solved by switching the default version of bundler from 1.17.2 to the current latest 2.2.3. (2) It was solved by changing the gem version from 3.0.3 to 3.2.3.

I feel that there are two patterns above.

It was just a solution in my environment, but it's the same bundler: failed to load command: spring I hope it will be helpful to those who have.

** Thank you for visiting! ** **

Recommended Posts

When creating an app with the new command in Ruby on Rails bundler: failed to load command: spring (/ Users/user name/directory name to create the app/app name/vendor/bundle/ruby ​​/ 2.6.0/bin/spring )
How to specify db when creating an app with rails
[Ruby on Rails] How to log in with only your name and password using the gem devise
What to do when Blocked Host: "host name" appears in Ruby on Rails
Ruby on Rails DB Tips for creating methods to reduce the load
Publish the app made with ruby on rails
Docker command to create Rails project with a single blow in environment without Ruby
[Ruby on Rails] How to change the column name
Rough procedure verbalized output when creating an app with Rails
Create a large number of records with one command using the Ruby on Rails seeds.rb file
How to make an application with ruby on rails (assuming that the environment has been built)
What to do if the app is not created with the latest Rails version installed when rails new
How to specify db when creating an app with rails
I want to add devise in Rails, but I can't bundle install
[Ruby on Rails] Use the resources method to automatically create routes.
Things to remember and concepts in the Ruby on Rails tutorial
(Ruby on Rails6) Create a function to edit the posted content
[Ruby on Rails] When logging in for the first time ・ How to split the screen in half using jQuery