Home > Software engineering >  localhost:3000 not working in browser (Rails 7)
localhost:3000 not working in browser (Rails 7)

Time:11-20

i typed rails s in the terminal and everything was working fine,

as my rails server was running i by mistakely pressed ctrl z on the keyboard and next time when i tried to run rails s , my terminal was showing an error

A server is already running. Check /home/..name/rprojects/railsapp/tmp/pids/server.pid.

so i checked other solutions on stackoverflow itself and i found out we need to delete the server.pid. file present inside it.

after when i deleted the server.pid. file and typed rails s to start the server in the terminal, my browser keeps on loading the http://localhost:3000/ and does not render anything, it just keeps on loading and nothing happens

so then i typed rails s -p 3001 in the terminal and it started working fine and everything is working normally on 3001 port

So how do i fix the loading problem on 3000 port when i run rails s in terminal and infinite loop of loading occurs and nothing happens??

even if i did not start the rails server in terminal and went on browser and typed http://localhost:3000/ , it keeps on loading and nothing shows

CodePudding user response:

You must kill the process by the PID which is in server.pid

sudo kill -9 PID

ex: the PID is 1000

sudo kill -9 1000

because you started another rails s, the PID was replaced.

You can run this cmd to find the PID of rails s

ps aux | grep rails

CodePudding user response:

I offen use this command line

  1. sudo kill -9 $(sudo lsof -t -i:3000) ( 3000 is port)
  2. Enter password
  3. restart server
  • Related