rails generate が全然動かない!時に試すこと
railsでコントローラーを作ろうと思ったら...
Rails 6.0.3.1 にて
いいね機能を実装すべく、likes_controller.rb
を作りたくて以下のコマンドを実行しました。
$ rails g controller likes
...うんともすんとも言わない
止めよう(^Cぽち)
^CTraceback (most recent call last):
16: from bin/rails:3:in `<main>'
15: from bin/rails:3:in `load'
14: from /リポジトリ名/bin/spring:15:in `<top (required)>'
13: from /Users/ユーザー名/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
12: from /Users/ユーザー名/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
11: from /Users/ユーザー名/.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/ユーザー名/.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/ユーザー名/.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/ユーザー名/.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/ユーザー名/.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/ユーザー名/.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/ユーザー名/.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/ユーザー名/.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/ユーザー名/.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/ユーザー名/.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/ユーザー名/.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/ユーザー名/.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
うわ
どうやらspringというのが怪しい
解決方法
spring
を止めちゃいます。
$ spring stop
Spring stopped.
止まります。
rails g
を再度実行!
$ 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
できた
ちなみに
さっき止めたspring
ですが、ステータスを確認するとしっかり動いていると思います。
$ spring status
Spring is running:
参考
Author And Source
この問題について(rails generate が全然動かない!時に試すこと), 我々は、より多くの情報をここで見つけました https://qiita.com/fjhrhnt/items/53991eda217e3966968e著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .