Rails - A server is already running
Not solved Solved
almost 2 years ago

Hi there, what's up? I have a problem when I want to start my server in my terminal I do rail s or rails server and there is an error:

A server is already running. Check /Users/baptiste/code/BaptisteB/my-app/tmp/pids/server.pid.

I delete it and when I check my localhost:3000. There is nothing. I have to log off my laptop and turn on it to begin to work.

How could I stop this recurrent error? Maybe could I destroy it with a command, but when I do that it appears every time I start to work on it. Thank you for your help.

almost 2 years ago

Type: "lsof -wni tcp:3000" in your terminal, and then "kill " for every process running. If you still get the same error, type "ps" and again "kill " for every process.

almost 2 years ago

My command to kill the process running on the 3000 port in the terminal is:

lsof -i :3000 | awk 'NR!=1 {print $2}' | xargs kill
almost 2 years ago

Oh, even shorter:

kill $(lsof -i tcp:3000 -t)
Submit your answer