LoginSignup
174
117

More than 5 years have passed since last update.

A server is already running 対処方法【Rails】

Last updated at Posted at 2017-03-06

Railsでサーバー起動したら以下エラーが発生しました。
昨日までは問題なかったのに~。。なんでだ!といっても始まらないので調べてみました。

環境

  • windows 8 64bit
  • Rails 4.1.16
  • Ruby 2.3.3

エラー

サーバー起動したら以下のエラーが発生しました。

$ C:\rails_book\devise> rails s
=> Booting WEBrick
=> Rails 4.1.16 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
A server is already running. Check C:/rails_book/devise/tmp/pids/server.pid.
Exiting

一番最後の英語をみると
「サーバーはすでに実行中です。C:/rails_book/devise/tmp/pids/server.pidを確認してください。」

となっている。
もしかして、昨日サーバー立ち上げたままPCの電源落としたからかな?(適当w)

解決方法

いくつか方法はある模様

①ターミナルを再起動(私はこれで治った。)

ターミナルを全部閉じて、再起動すれば解決しました。
偉大なり、再起動!


②server.pidファイルを削除

以下のパスにあるファイルを削除します。

[Railsプロジェクトフォルダ]\tmp\pids\server.pid

これがサーバー起動する際に使用しているIDっぽい。
サーバー終了すると削除されるようですが、エラー発生時は残ったままでした。

実際、サーバー起動と終了をしてみるとserver.pidが作られたり、削除されたり
しているのが確認できます。

174
117
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
174
117