19
8

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 5 years have passed since last update.

rails console が起動できない!

Last updated at Posted at 2019-06-01

rails cをやったら固まった!

$ bundle exec rails c



...。
...動かない!

結論

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

$ bundle exec spring stop
Spring stopped.

やったこと

裏で動いているプロセスがないか確認

$ ps aux | grep rails
yuma             45034   0.0  0.0  4294644    828 s002  S+    4:12PM   0:00.01 grep rails
yuma             44972   0.0  0.1  4308436  11600 s005  S+    4:09PM   0:01.31 /Users/yuma/.rbenv/versions/2.5.1/bin/ruby bin/rails c 

怪しいプロセスがあったのでkillしてみる。

$ kill -9 44972
$ bundle exec rails c



Killed: 9

固まってたプロセスをkillしただけだった。

ググった

springって奴が悪さしているらしい。

springってなんだ?
Githubから引用[https://github.com/rails/spring]

Spring is a Rails application preloader. It speeds up development by keeping your application running in the background so you don't need to boot it every time you run a test, rake task or migration.

裏で動いてアプリを快適にしてくれるものらしい。
プロセスを確認しよう。

$ ps aux | grep spring
yuma             44038   0.0  0.1  4331580   7464   ??  Ss    2:50PM   0:05.84 spring app    | hoge | started 4 secs ago | development mode      
yuma             16044   0.0  0.0  4314604   1140 s004  S     7 519    0:01.07 spring server | hoge | started 171 hours ago   
yuma             45196   0.0  0.0  4286452    820 s002  S+    4:17PM   0:00.01 grep spring

16044がすでに立っていた。
$ spring stopで止まるらしい。

$ bundle exec spring stop
Spring stopped.

これで動いたー!

19
8
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
19
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?