0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Railsコマンドが動作しなくなって困った話

Posted at

状況整理

  • Railsアプリを作り勉強中
  • rails g ~~~ を実行するとターミナルがフリーズ
  • control + cで止めるとエラーが出力される
  • ターミナルを閉じても状況変わらず上記をループ

現状

エラーコードの内容はこんな感じです。

Traceback (most recent call last):
        17: from bin/rails:2:in `<main>'
        16: from bin/rails:2:in `load'
        15: from /Users/ryo/git/sample/bin/spring:7:in `<top (required)>'
        14: from /Users/ryo/git/sample/bin/spring:7:in `tap'
        13: from /Users/ryo/git/sample/bin/spring:10:in `block in <top (required)>'
        12: from /Users/ryo/git/sample/bin/spring:10:in `require'
        11: from /Users/ryo/git/sample/vendor/bundle/ruby/2.7.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
        10: from /Users/ryo/git/sample/vendor/bundle/ruby/2.7.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load'
         9: from /Users/ryo/git/sample/vendor/bundle/ruby/2.7.0/gems/spring-2.1.1/bin/spring:49:in `<top (required)>'
         8: from /Users/ryo/git/sample/vendor/bundle/ruby/2.7.0/gems/spring-2.1.1/lib/spring/client.rb:30:in `run'
         7: from /Users/ryo/git/sample/vendor/bundle/ruby/2.7.0/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
         6: from /Users/ryo/git/sample/vendor/bundle/ruby/2.7.0/gems/spring-2.1.1/lib/spring/client/rails.rb:24:in `call'
         5: from /Users/ryo/git/sample/vendor/bundle/ruby/2.7.0/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
         4: from /Users/ryo/git/sample/vendor/bundle/ruby/2.7.0/gems/spring-2.1.1/lib/spring/client/run.rb:35:in `call'
         3: from /Users/ryo/git/sample/vendor/bundle/ruby/2.7.0/gems/spring-2.1.1/lib/spring/client/run.rb:42:in `warm_run'
         2: from /Users/ryo/git/sample/vendor/bundle/ruby/2.7.0/gems/spring-2.1.1/lib/spring/client/run.rb:62:in `run'
         1: from /Users/ryo/git/sample/vendor/bundle/ruby/2.7.0/gems/spring-2.1.1/lib/spring/client/run.rb:117:in `verify_server_version'
/Users/ryo/git/sample/vendor/bundle/ruby/2.7.0/gems/spring-2.1.1/lib/spring/client/run.rb:117:in `gets': Interrupt

springが関係してる感じ?

対応

とりあえずプロセスを確認

ps aux | grep spring
ryo    34384   0.7  0.1  4404564  10456   ??  Ss   11 721   13:57.60 ruby -I /Users/ryo/git/53/vendor/bundle/ruby/2.7.0/gems/spring-2.1.1/lib -e require 'spring/application/boot'
ryo    67650   0.0  0.1  4389184  11980   ??  S    11:34AM   0:00.34 spring server | sample | started 1 hour ago   
ryo    19556   0.0  0.0  4384084   4388   ??  S     8 721    0:00.42 spring server | project_53 | started 362 hours ago   
ryo    70187   0.0  0.0  4268424    696 s003  S+    1:30PM   0:00.00 grep spring

一旦再起動させてみた

$ kill -9 67650

再度rails g を実行

$ rails g model User name:string email:string
invoke  active_record
      create    db/migrate/20210723043237_create_users.rb
      create    app/models/user.rb

なおりました!

参考資料

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?