我有一个新的Rails应用程序和Vagrant一起运行,前向端口在Vagrant文件中设置为3000
config.vm.forward_port 3000, 3000
在我关闭服务器并退出流浪者后,我得到了这个输出`连接到127.0.0.1关闭',但是当我试图启动我的Rails应用程序而不使用Vagrant它告诉我
[2013-07-30 12:18:41] INFO WEBrick 1.3.1
[2013-07-30 12:18:41] INFO ruby 2.0.0 (2013-05-14) [x86_64-darwin12.4.0]
[2013-07-30 12:18:41] WARN TCPServer Error: Address already in use - bind(2)
Exiting
/Users/mm.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/webrick/utils.rb:85:in `initialize': Address already in use - bind(2) (Errno::EADDRINUSE)
from /Users/mm.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/webrick/utils.rb:85:in `new'
from /Users/mm.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/webrick/utils.rb:85:in `block in create_listeners'
from /Users/mm.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/webrick/utils.rb:82:in `each'
from /Users/mm.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/webrick/utils.rb:82:in `create_listeners'
from /Users/mm.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/webrick/server.rb:132:in `listen'
from /Users/mm.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/webrick/server.rb:113:in `initialize'
from /Users/mm.rbenv/versions/2.0.0-p195/lib/ruby/2.0.0/webrick/httpserver.rb:45:in `initialize'
from /Users/mm.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:11:in `new'
from /Users/mm.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:11:in `run'
from /Users/mm.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:264:in `start'
from /Users/mm.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands/server.rb:84:in `start'
from /Users/mm.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:78:in `block in <top (required)>'
from /Users/mm.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
from /Users/mm.rbenv/versions/2.0.0-p195/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
谷歌搜索告诉我,我应该这样做
ps ax | grep ruby
然后杀死进程但我被告知没有进程使用grep返回的数字。
michael$ ps ax | grep ruby
3604 s001 R+ 0:00.00 grep ruby
michael$ kill -9 3604
-bash: kill: (3604) - No such process
如果这与我对Vagrant的使用有关,我知道如何解决这个问题吗?
更新
尝试在此SO回答TCPServer Error: Address already in use - bind(2)找到的命令lsof -wni tcp:3000
也无法终止该过程
michael$ lsof -wni tcp:3000
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
VBoxHeadl 601 mm 22u IPv4 0x888bec8d3960ddb1 0t0 TCP *:hbci (LISTEN)
michael$ kill -9 PID
-bash: kill: PID: arguments must be process or job IDs