[RUBY] rails generate doesn't work at all! Sometimes try

If you want to make a controller with rails ...

In Rails 6.0.3.1 In order to implement the like function, I ran the following command to create likes_controller.rb.

$ rails g controller likes

... I don't say yes or no: cry:

Let's stop (^ C Pochi)

^CTraceback (most recent call last):
	16: from bin/rails:3:in `<main>'
	15: from bin/rails:3:in `load'
	14: from /Repository name/bin/spring:15:in `<top (required)>'
	13: from /Users/username/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
	12: from /Users/username/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
	11: from /Users/username/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `<top (required)>'
	10: from /Users/username/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `load'
	 9: from /Users/username/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/spring-2.1.0/bin/spring:49:in `<top (required)>'
	 8: from /Users/username/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/spring-2.1.0/lib/spring/client.rb:30:in `run'
	 7: from /Users/username/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/spring-2.1.0/lib/spring/client/command.rb:7:in `call'
	 6: from /Users/username/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/spring-2.1.0/lib/spring/client/rails.rb:24:in `call'
	 5: from /Users/username/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/spring-2.1.0/lib/spring/client/command.rb:7:in `call'
	 4: from /Users/username/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/spring-2.1.0/lib/spring/client/run.rb:35:in `call'
	 3: from /Users/username/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/spring-2.1.0/lib/spring/client/run.rb:42:in `warm_run'
	 2: from /Users/username/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/spring-2.1.0/lib/spring/client/run.rb:62:in `run'
	 1: from /Users/username/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/spring-2.1.0/lib/spring/client/run.rb:117:in `verify_server_version'
/Users/username/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/spring-2.1.0/lib/spring/client/run.rb:117:in `gets': Interrupt

Wow Apparently spring is suspicious: thinking_face:

Solution

I will stop spring. : upside_down:

$ spring stop
Spring stopped.

Stop. Run rails g again!

$ rails g controller likes
Running via Spring preloader in process 23035
      create  app/controllers/likes_controller.rb
      invoke  erb
      create    app/views/likes
      invoke  test_unit
      create    test/controllers/likes_controller_test.rb
      invoke  helper
      create    app/helpers/likes_helper.rb
      invoke    test_unit
      invoke  assets
      invoke    scss
      create      app/assets/stylesheets/likes.scss

Done: raised_hands:

By the way

It's spring that I stopped earlier, but when I check the status, I think it's working well. : runner_tone2:

$ spring status
Spring is running:

reference

https://stackoverflow.com/questions/25027284/ruby-on-rails-console-is-hanging-when-loading

Recommended Posts

rails generate doesn't work at all! Sometimes try
[Beginner] When rails s doesn't work
Links I want to help when JSF doesn't work at all
SCSS doesn't work when deploying Rails6 AWS
[heroku] run rails db: migrate doesn't work