LoginSignup
14
14

More than 5 years have passed since last update.

【Rails5.1】ローカルのPumaが起動しない場合の対処法

Posted at

はじめに

久々に起動したローカルのPumaが起動しなかったのでメモ。

エラー内容

$ bundle exec rails s -b 0.0.0.0
=> Booting Puma
=> Rails 5.1.1 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.9.1 (ruby 2.4.1-p111), codename: Private Caller
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://0.0.0.0:3000
Exiting
/home/vagrant/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/puma-3.9.1/lib/puma/binder.rb:269:in `initialize': Address already in use - bind(2) for "0.0.0.0" port 3000 (Errno::EADDRINUSE)

対処法

  • 3000ポートを使っているプロセスがないか確認します。
$ ps -aux | grep puma
vagrant   6334  3.5 21.7 1550588 445276 ?      Sl   09:48   1:44 puma 3.9.1 (tcp://0.0.0.0:3000)
vagrant   7147  0.0  0.0  15524   940 pts/19   S+   10:37   0:00 grep --color=auto puma

プロセスをkillします。

$ sudo kill -9 6334
$ ps -aux | grep puma
vagrant   7160  0.0  0.0  15524  1036 pts/19   S+   10:37   0:00 grep --color=auto puma

puma再起動

無事に起動できました。

$ bundle exec rails s -b 0.0.0.0
=> Booting Puma
=> Rails 5.1.1 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.9.1 (ruby 2.4.1-p111), codename: Private Caller
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://0.0.0.0:3000
Use Ctrl-C to stop
14
14
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
14
14