Home > Net >  A server is already running. (Ruby on Rails)
A server is already running. (Ruby on Rails)

Time:10-26

I was practicing doing ruby on rails and I accidentally closed Visual Studio code while the terminal and rails server is running.

This is what happened after i typed rails s

PS C:\Users\Lenovo\Desktop\folder_name\project_name rails s
=> Booting Puma
=> Rails 6.1.4.1 application starting in development     
=> Run `bin/rails server --help` for more startup options
A server is already running. Check C:/Users/Lenovo/Desktop/folder_name/project_name/tmp/pids/server.pid.
Exiting

CodePudding user response:

  1. Find the process id for the rails server port :

    lsof -wni tcp:3000

  2. Copy value in PID column

  3. Kill the process (for example 14400) :

    kill -9 14400

CodePudding user response:

You can use this command to kill the server using port number.

sudo kill -9 $(lsof -i :3000 -t)

CodePudding user response:

The user just needed to delete the server.pid file and it worked.

  • Related