A server is already running. Check …/tmp/pids/server.pid. Exiting - rails

前端 未结 19 1444
礼貌的吻别
礼貌的吻别 2021-01-29 20:35
..$ rails s
=> Booting WEBrick
=> Rails 4.0.4 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=>         


        
相关标签:
19条回答
  • 2021-01-29 20:58

    If you are using docker-compose, and in docker-compose.yml have: volumes: - .:/myapp That means you local workspace is mapped to the container's /myapp folder.

    Anything in /myapp will not be deleted for the volumes define.

    You can delete ./tmp/pids/server.pid in you local machine. Then the container's /myapp will not have this file.

    0 讨论(0)
  • 2021-01-29 20:58

    Run this command -

    lsof -wni tcp:3000

    then you will get the following table -

    COMMAND  PID  USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
    ruby    2552 shyam   17u  IPv4  44599      0t0  TCP 127.0.0.1:3000 (LISTEN)
    ruby    2552 shyam   18u  IPv6  44600      0t0  TCP [::1]:3000 (LISTEN)

    Run this command and replace PID from the Above table

    kill -9 PID

    example:

    kill -9 2552

    0 讨论(0)
  • 2021-01-29 20:59

    You can delete the server.pid file.

    rm /your_project_path/tmp/pids/server.pid
    

    Else:

    try in OSX:

    sudo lsof -iTCP -sTCP:LISTEN -P | grep :3000
    

    or in linux:

    ps -aef | grep rails

    or

    lsof -wni tcp:3000
    

    kill the process using

    kill -9 PID (eg,2786)
    
    0 讨论(0)
  • 2021-01-29 21:01

    For this problem,

    What i did is:

    • Delete the Pids folder which is located under app/tmp/
    • and then, close the terminal which we are running the current app and close the tab (in, browser window)

    • after that, again open the terminal by going inside the folder, and then do, rails s

    • Then, it opens the fresh tab which is running our application
    0 讨论(0)
  • 2021-01-29 21:03

    SOLUTION for Windows:

    1. see the pid from \tmp\pids\server.pid
    2. open cmd as administrator
    3. taskkill /F /PID [pid from step 1.]
    4. delete server.pid file
    5. restart server
    0 讨论(0)
  • 2021-01-29 21:06

    It happens sometimes because you turn off the server by force, for example turning off the OS/machine manually so that the server does not have enough time to log to server.pid.

    One easy way is to manually go to tmp/pids/ (the directory that is shown in your console.) and remove server.pid file. Then, when you start the server again, rails server or rails s ,it creates a new server.pid and you can continue development.

    0 讨论(0)
提交回复
热议问题