Faye 服务器未启动或启动
我正在关注 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了解决方案。相反,我运行了
rackup -s Thin -E production config.ru
(config.ru 而不是 faye.ru),并得到了一个工作服务器,其中包括:显然,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:Apparently, Rack's development middleware doesn't work with Thin async responses as I am using Thin in this app.