Rails 服务器说端口已使用,如何终止该进程? [英] Rails server says port already used, how to kill that process?
本文介绍了Rails 服务器说端口已使用,如何终止该进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 Mac 上,正在做:
I'm on a mac, doing:
rails server
我明白了:
2010-12-17 12:35:15] INFO WEBrick 1.3.1
[2010-12-17 12:35:15] INFO ruby 1.8.7 (2010-08-16) [i686-darwin10.4.0]
[2010-12-17 12:35:15] WARN TCPServer Error: Address already in use - bind(2)
Exiting
我知道我可以在一个新端口上启动一个,但我想终止这个进程.
I know I can start one on a new port, but I want to kill this process.
推荐答案
假设您想杀死端口 3000(这是 webrick 通常使用的端口)上的任何内容,请在终端中键入它以找出该端口的 PID过程:
Assuming you're looking to kill whatever is on port 3000 (which is what webrick normally uses), type this in your terminal to find out the PID of the process:
$ lsof -wni tcp:3000
然后,使用PID列中的数字杀死进程:
Then, use the number in the PID column to kill the process:
$ kill -9 PID
这篇关于Rails 服务器说端口已使用,如何终止该进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文