Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for [Fix] Rails server is already running
Truemark Technology profile imagePrabin Poudel
Prabin Poudel forTruemark Technology

Posted on • Edited on • Originally published atprabinpoudel.com.np

     

[Fix] Rails server is already running

Error

"A server is already running. Check.../tmp/pids/server.pid"

This error means that the server is already running in the port you are trying to start the rails server on; normally 3000.

Reasons for Error

This error can occur in two cases:

  1. You are running the Rails server on port 3000 in another tab of the terminal

  2. You suspended the server abruptly

    This normally happens when you stop the server withctrl+z instead ofctrl+c to exit the Rails server.ctrl+z suspends the process but doesn't close the server running on port 3000 meaning the server is still running on background.

    This can also happen when you close the terminal that the rails server was running on.

Solution

Rails server is running on port 3000 in another tab of the terminal

You can just close the server running on another tab on port 3000 to resolve this issue.

Server suspended abruptly

Solution for this case is to kill the process running in the background on port 3000

  1. Find the process id for the rails server port

    If the port you are running the rails server is different than 3000, you should replace 3000 with the port number as required.

       lsof -wni tcp:3000

    You should be able to see the output like this:

      COMMAND   PID USER   FD   TYPE            DEVICE SIZE/OFF NODE NAME  ruby    16660 cool   14u  IPv4 0x89786e1f70a36a3      0t0  TCP 127.0.0.1:hbci (LISTEN)  ruby    16660 cool   15u  IPv6 0x89786e1d82f7aeb      0t0  TCP [::1]:hbci (LISTEN)
  2. Copy value in PID column, here16660

  3. Kill the process

       kill -9 16660

    You should see the following output:

       [1]  + 10975 killed     rails s
  4. Try running the server again

Conclusion

Rails server should be up and running without any errors now.

Thank you for reading. Happy Coding!

References

Image Credits

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

More fromTruemark Technology

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp