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

前端 未结 19 1441
礼貌的吻别
礼貌的吻别 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:42

    Simple:

    go in the root folder of the project when this happens and run:

    gem install shutup
    shutup
    

    This will find the process currently running, kill it and clean up the pid file

    NOTE: if you are using rvm install the gem globally

    rvm @global do gem install shutup
    
    0 讨论(0)
  • 2021-01-29 20:43

    server.pid only contains the process ID of the running server.

    If you do:

    more /your_project_path/tmp/pids/server.pid
    

    you will get a number (say 6745) which you can use to stop the previous server with the command kill:

    kill -9 6745
    

    and then you can remove the file with the rm command

    rm /your_project_path/tmp/pids/server.pid
    
    0 讨论(0)
  • 2021-01-29 20:43

    For ubuntu 20, kill -9 $(ps -aef | grep rails)

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

    first copy the cumber inside the file then remove it: rm /your_project_path/tmp/pids/server.pid then create it again. touch /YOUR_PROJECT_PATH/tmp/pids/server.pid It worked for me.

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

    SOLVING

    Address already in use — bind(2)” 500 error in Ruby on Rails

    Recently I tried running a Rails app on a production server. Not only did it not work, but it broke my localhost:3000 development server as well. Localhost would only load a blank white page or a 500 error.

    To solve this, I used two quick commands. If these don’t return a result, you may need to look elsewhere for a solution, but this is a good quick fix.

    lsof -wni tcp:3000

    
    ruby    52179 rachelchervin   50u  IPv6 0x...7aa3      0t0  TCP [::1]:hbci (LISTEN)
    ruby    52179 rachelchervin   51u  IPv4 0x...c7bb      0t0  TCP 127.0.0.1:hbci (LISTEN)
    ruby    52180 rachelchervin   50u  IPv6 0x...7aa3      0t0  TCP [::1]:hbci (LISTEN)
    ruby    52180 rachelchervin   51u  IPv4 0x...c7bb      0t0  TCP 127.0.0.1:hbci (LISTEN)
    
    

    This command shows all of my currently running processes and their PIDs (process IDs) on the 3000 port. Because there are existing running processes that did not close correctly, my new :3000 server can’t start, hence the 500 error.

    kill 52179

    kill 52180

    rails s

    I used the Linux kill command to manually stop the offending processes. If you have more than 4, simply use kill on any PIDs until the first command comes back blank. Then, try restarting your localhost:3000 server again. This will not damage your computer! It simply kills existing ruby processes on your localhost port. A new server will start these processes all over again. Good luck!

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

    Issue can be solved using:

    kill -9 $(more /home/..name/rprojects/railsapp/tmp/pids/server.pid)
    
    0 讨论(0)
提交回复
热议问题