Sinatra Sinatra 使用中的一个问题

wpdreammelody · 2014年11月06日 · 最后由 ChrisLoong 回复于 2014年11月06日 · 8204 次阅读

我在运行一个 rb 之后,CTRL+C to stop,重新修改了同一个 rb 文件,然后再 ruby xx.rb ruby app_get.rb == Sinatra/1.4.5 has taken the stage on 4567 for development with backup from Thin Thin web server (v1.6.3 codename Protein Powder) Maximum connections set to 1024 Listening on localhost:4567, CTRL+C to stop Stopping ... == Sinatra has ended his set (crowd applauds) /Users/melody/.rvm/gems/ruby-2.1.3/gems/eventmachine-1.0.3/lib/eventmachine.rb:526:in start_tcp_server': no acceptor (port is in use or requires root privileges) (RuntimeError) from /Users/melody/.rvm/gems/ruby-2.1.3/gems/eventmachine-1.0.3/lib/eventmachine.rb:526:instart_server' from /Users/melody/.rvm/gems/ruby-2.1.3/gems/thin-1.6.3/lib/thin/backends/tcp_server.rb:16:in connect' from /Users/melody/.rvm/gems/ruby-2.1.3/gems/thin-1.6.3/lib/thin/backends/base.rb:63:inblock in start' from /Users/melody/.rvm/gems/ruby-2.1.3/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in call' from /Users/melody/.rvm/gems/ruby-2.1.3/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:inrun_machine' from /Users/melody/.rvm/gems/ruby-2.1.3/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in run' from /Users/melody/.rvm/gems/ruby-2.1.3/gems/thin-1.6.3/lib/thin/backends/base.rb:73:instart' from /Users/melody/.rvm/gems/ruby-2.1.3/gems/thin-1.6.3/lib/thin/server.rb:162:in start' from /Users/melody/.rvm/gems/ruby-2.1.3/gems/rack-1.6.0.beta/lib/rack/handler/thin.rb:19:inrun' from /Users/melody/.rvm/gems/ruby-2.1.3/gems/sinatra-1.4.5/lib/sinatra/base.rb:1497:in start_server' from /Users/melody/.rvm/gems/ruby-2.1.3/gems/sinatra-1.4.5/lib/sinatra/base.rb:1435:inrun!' from /Users/melody/.rvm/gems/ruby-2.1.3/gems/sinatra-1.4.5/lib/sinatra/main.rb:25:in `block in module:Sinatra'

总是会遇到,如何解决?? 还有我能不能一直 start Thin 服务,修改 rb 文件后,不再需要先 Stop 在 Star 服务,而是直接刷新下,就可以测试我文件修改是否正确???

(port is in use or requires root privileges)

应该是端口号 4567 被占用。

ss -anp | grep 4567

检查看看。

你需要用reloader

需要 登录 后方可回复, 如果你还没有账号请 注册新账号