开发者

Starting rails server always throws socket error

Nine times out of ten, whenever I start either the default rails webrick server, or thin server, I get a socket error. I have to do lsof | grep IPv4, find the ruby process, then kill -9 the PID. It seems like I'm doing this all the time... is there not a permanent solution to 开发者_C百科this? Is it b/c I sometimes close the terminal window without control+C'ing the server instance?


Yes, it is probably because you are not killing the server instance. By default, the server listens on localhost:3000, so if the process is still alive after you quit your terminal, it is still occupying the port, and attempting to start another server will fail. Just control-c your servers before you close the terminal session and you shouldn't have any more issues.


Aso if you can use rails s -p x .In this x is port no 3000 or 3001 etc.you will not get any bind error if ctrl + c is not pressed to close the server.Also it's better to use ctrl + c to close the server

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜