简体   繁体   English

无法启动rails服务器

[英]Unable to start rails server

I am trying to start rails server using rails s command. 我正在尝试使用rails s命令启动rails服务器。 But i'm getting the following error: 但是我收到以下错误:

A server is already running. Check repo/tmp/pids/server.pid.

I checked the file, but its blank. 我检查了文件,但它的空白。 There is no id in the server.pid file. server.pid文件中没有id。 Then I tried to find out the process running on port 3000 using the command lsof -wni tcp:3000 . 然后我尝试使用命令lsof -wni tcp:3000找出在端口3000上运行的进程。 It also does not show any id. 它也没有显示任何ID。

Then I tried starting the server on a different port using rails s -p 3001 , but this also gives the same error. 然后我尝试使用rails s -p 3001在不同的端口上启动服务器,但这也会产生相同的错误。 Please could someone explain what is going on. 请有人解释一下发生了什么。

Thanks 谢谢

EDIT: does not work even after restarting computer 编辑:即使重新启动计算机后仍无法正常工作

只需删除该文件:

 rm repo/tmp/pids/server.pid

Try running this command in your terminal window. 尝试在终端窗口中运行此命令。

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

If it doesn't work, you can always just restart your computer/server... 如果它不起作用,您可以随时重新启动计算机/服务器...

1- Use the command below for checking that how many server currently running 1-使用以下命令检查当前正在运行的服务器数量

$ ps aux | $ ps aux | grep rails grep rails


2- For killing the existing server 2-用于查杀现有服务器

$ kill -9 pid $ kill -9 pid

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM