Faye 服务器未启动或启动

发布于 2024-12-21 08:52:40 字数 1833 浏览 2 评论 0原文

我正在关注 Railscast 并完全按照说明进行操作。我什至使用 net.tutsplus 的 faye.ru 代码在根目录中设置 faye.ru 文件。

这是 faye.ru 文件:

require 'faye'
faye_server = Faye::RackAdapter.new(:mount => '/faye', :timeout => 45)
run faye_server

当我尝试使用 rackup faye.ru -s Thin -E Production 启动服务器时,

出现以下错误:

/Users/TonyNg/faye-tutorial/faye.ru:3:in `block in <main>': undefined local variable or method ` ' for #<Rack::Builder:0x00000100918420 @ins=[]> (NameError)
    from /Users/TonyNg/.rvm/gems/ruby-1.9.3-p0@rails313/gems/rack-1.3.5/lib/rack/builder.rb:51:in `instance_eval'
    from /Users/TonyNg/.rvm/gems/ruby-1.9.3-p0@rails313/gems/rack-1.3.5/lib/rack/builder.rb:51:in `initialize'
    from /Users/TonyNg/faye-tutorial/faye.ru:1:in `new'
    from /Users/TonyNg/faye-tutorial/faye.ru:1:in `<main>'
    from /Users/TonyNg/.rvm/gems/ruby-1.9.3-p0@rails313/gems/rack-1.3.5/lib/rack/builder.rb:40:in `eval'
    from /Users/TonyNg/.rvm/gems/ruby-1.9.3-p0@rails313/gems/rack-1.3.5/lib/rack/builder.rb:40:in `parse_file'
    from /Users/TonyNg/.rvm/gems/ruby-1.9.3-p0@rails313/gems/rack-1.3.5/lib/rack/server.rb:200:in `app'
    from /Users/TonyNg/.rvm/gems/ruby-1.9.3-p0@rails313/gems/rack-1.3.5/lib/rack/server.rb:301:in `wrapped_app'
    from /Users/TonyNg/.rvm/gems/ruby-1.9.3-p0@rails313/gems/rack-1.3.5/lib/rack/server.rb:252:in `start'
    from /Users/TonyNg/.rvm/gems/ruby-1.9.3-p0@rails313/gems/rack-1.3.5/lib/rack/server.rb:137:in `start'
    from /Users/TonyNg/.rvm/gems/ruby-1.9.3-p0@rails313/gems/rack-1.3.5/bin/rackup:4:in `<top (required)>'
    from /Users/TonyNg/.rvm/gems/ruby-1.9.3-p0@rails313/bin/rackup:19:in `load'
    from /Users/TonyNg/.rvm/gems/ruby-1.9.3-p0@rails313/bin/rackup:19:in `<main>'

它似乎只适用于 Ryan,但我'我运气不好。

I'm following railscast and have followed the instructions exactly. I've even used net.tutsplus's faye.ru code to set up the faye.ru file in the root directory.

Here's the faye.ru file:

require 'faye'
faye_server = Faye::RackAdapter.new(:mount => '/faye', :timeout => 45)
run faye_server

When I try to launch the server with rackup faye.ru -s thin -E production,

I get the following error:

/Users/TonyNg/faye-tutorial/faye.ru:3:in `block in <main>': undefined local variable or method ` ' for #<Rack::Builder:0x00000100918420 @ins=[]> (NameError)
    from /Users/TonyNg/.rvm/gems/ruby-1.9.3-p0@rails313/gems/rack-1.3.5/lib/rack/builder.rb:51:in `instance_eval'
    from /Users/TonyNg/.rvm/gems/ruby-1.9.3-p0@rails313/gems/rack-1.3.5/lib/rack/builder.rb:51:in `initialize'
    from /Users/TonyNg/faye-tutorial/faye.ru:1:in `new'
    from /Users/TonyNg/faye-tutorial/faye.ru:1:in `<main>'
    from /Users/TonyNg/.rvm/gems/ruby-1.9.3-p0@rails313/gems/rack-1.3.5/lib/rack/builder.rb:40:in `eval'
    from /Users/TonyNg/.rvm/gems/ruby-1.9.3-p0@rails313/gems/rack-1.3.5/lib/rack/builder.rb:40:in `parse_file'
    from /Users/TonyNg/.rvm/gems/ruby-1.9.3-p0@rails313/gems/rack-1.3.5/lib/rack/server.rb:200:in `app'
    from /Users/TonyNg/.rvm/gems/ruby-1.9.3-p0@rails313/gems/rack-1.3.5/lib/rack/server.rb:301:in `wrapped_app'
    from /Users/TonyNg/.rvm/gems/ruby-1.9.3-p0@rails313/gems/rack-1.3.5/lib/rack/server.rb:252:in `start'
    from /Users/TonyNg/.rvm/gems/ruby-1.9.3-p0@rails313/gems/rack-1.3.5/lib/rack/server.rb:137:in `start'
    from /Users/TonyNg/.rvm/gems/ruby-1.9.3-p0@rails313/gems/rack-1.3.5/bin/rackup:4:in `<top (required)>'
    from /Users/TonyNg/.rvm/gems/ruby-1.9.3-p0@rails313/bin/rackup:19:in `load'
    from /Users/TonyNg/.rvm/gems/ruby-1.9.3-p0@rails313/bin/rackup:19:in `<main>'

It seems to just work for Ryan, but I'm out of luck.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

盗梦空间 2024-12-28 08:52:40

我找到了解决方案。相反,我运行了 rackup -s Thin -E production config.ruconfig.ru 而不是 faye.ru),并得到了一个工作服务器,其中包括:

>> Thin web server (v1.3.1 codename Triple Espresso)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:9292, CTRL+C to stop

显然,Rack 的开发中间件不适用于 Thin 异步响应,因为我在此应用程序中使用 Thin。

I found a solution. I instead ran rackup -s thin -E production config.ru (config.ru instead of faye.ru) and got a working server consisting of:

>> Thin web server (v1.3.1 codename Triple Espresso)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:9292, CTRL+C to stop

Apparently, Rack's development middleware doesn't work with Thin async responses as I am using Thin in this app.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文