LoginSignup
1
0

More than 3 years have passed since last update.

【備忘録】rails console が起動できない場合

Posted at

rails consoleを実行するとターミナルが固まってしまい立ち上がらないという現象が起こったため、解決法を忘れないように備忘録として残しておきます。

結論

springを止めたら起動できるようになります!

手順

ターミナル
# 裏で動いているプロセスがないか確認
$ ps aux | grep rails
ユーザー名      9005   0.0  0.0  4268284    680 s000  S+   10:20PM   0:00.01 grep rail
# 特になかった。
ターミナル
# spring(裏で動いてアプリを快適にしてくれるもの)を確認
$ ps aux | grep spring
ユーザー名      6544   0.0  0.3  4375700  24804   ??  Rs    9:48PM   0:01.36 spring app    | my_portfolio4 | started 0 secs ago | development mode      
ユーザー名      6543   0.0  0.3  4374676  24876   ??  Rs    9:48PM   0:01.37 spring app    | my_portfolio4 | started 0 secs ago | test mode      
ユーザー名       931   0.0  0.1  4372216  11024   ??  S    02PM   0:01.01 spring server | my_portfolio4 | started 55 hours ago   
ユーザー名      9064   0.0  0.0  4297404    576 s000  R+   10:21PM   0:00.00 grep spring
# startedと書かれているし、動いていそうな雰囲気。。。
ターミナル
# 止めてみる。
$ bundle exec spring stop
Spring stopped.
ターミナル
# 再度コマンドの実行をしてみる。
$ rails console 
Running via Spring preloader in process 9252
Loading development environment (Rails 6.0.3)
[1] pry(main)> 

無事に起動しました!!

【参考記事】
https://qiita.com/YumaFuu/items/aa10290e8c48613089a6

1
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
1
0