Unicorn 显示 Rack 错误未初始化常量 Rack::Lint::REQUEST_METHOD

Unicorn 显示 Rack 错误未初始化常量 Rack::Lint::REQUEST_METHOD

我尝试在 Ubuntu 14.04 上安装 Unicorn + Nginx。每当访问该网站时(通过 localhost:8080 或通过 Nginx),它只会返回一个空白的 500 错误。错误日志显示以下内容:

NameError: uninitialized constant Rack::Lint::REQUEST_METHOD
    /var/lib/gems/1.9.1/gems/rack-1.6.0/lib/rack/lint.rb:298:in `check_env'
    /var/lib/gems/1.9.1/gems/rack-1.6.0/lib/rack/lint.rb:43:in `_call'
    /var/lib/gems/1.9.1/gems/rack-1.6.0/lib/rack/lint.rb:37:in `call'
    /var/lib/gems/1.9.1/gems/rack-1.6.0/lib/rack/showexceptions.rb:24:in `call'
    /var/lib/gems/1.9.1/gems/rack-1.6.0/lib/rack/commonlogger.rb:33:in `call'
    /var/lib/gems/1.9.1/gems/sinatra-1.4.6/lib/sinatra/base.rb:218:in `call'
    /var/lib/gems/1.9.1/gems/rack-1.6.0/lib/rack/chunked.rb:54:in `call'
    /var/lib/gems/1.9.1/gems/rack-1.6.0/lib/rack/content_length.rb:15:in `call'
    /usr/lib/ruby/vendor_ruby/unicorn/http_server.rb:580:in `process_client'
    /usr/lib/ruby/vendor_ruby/unicorn/http_server.rb:660:in `worker_loop'
    /usr/lib/ruby/vendor_ruby/unicorn/http_server.rb:527:in `spawn_missing_workers'
    /usr/lib/ruby/vendor_ruby/unicorn/http_server.rb:153:in `start'
    /usr/bin/unicorn:126:in `<main>'
E, [2015-04-11T11:20:00.945818 #25817] ERROR -- : app error: uninitialized constant Rack::Request::SCRIPT_NAME (NameError)
E, [2015-04-11T11:20:00.945882 #25817] ERROR -- : /var/lib/gems/1.9.1/gems/rack-1.6.0/lib/rack/request.rb:21:in `script_name'
E, [2015-04-11T11:20:00.945904 #25817] ERROR -- : /var/lib/gems/1.9.1/gems/rack-1.6.0/lib/rack/showexceptions.rb:69:in `pretty'
E, [2015-04-11T11:20:00.945926 #25817] ERROR -- : /var/lib/gems/1.9.1/gems/rack-1.6.0/lib/rack/showexceptions.rb:33:in `rescue in call'
E, [2015-04-11T11:20:00.945946 #25817] ERROR -- : /var/lib/gems/1.9.1/gems/rack-1.6.0/lib/rack/showexceptions.rb:24:in `call'
E, [2015-04-11T11:20:00.945964 #25817] ERROR -- : /var/lib/gems/1.9.1/gems/rack-1.6.0/lib/rack/commonlogger.rb:33:in `call'
E, [2015-04-11T11:20:00.945984 #25817] ERROR -- : /var/lib/gems/1.9.1/gems/sinatra-1.4.6/lib/sinatra/base.rb:218:in `call'
E, [2015-04-11T11:20:00.946001 #25817] ERROR -- : /var/lib/gems/1.9.1/gems/rack-1.6.0/lib/rack/chunked.rb:54:in `call'
E, [2015-04-11T11:20:00.946018 #25817] ERROR -- : /var/lib/gems/1.9.1/gems/rack-1.6.0/lib/rack/content_length.rb:15:in `call'
E, [2015-04-11T11:20:00.946034 #25817] ERROR -- : /usr/lib/ruby/vendor_ruby/unicorn/http_server.rb:580:in `process_client'
E, [2015-04-11T11:20:00.946056 #25817] ERROR -- : /usr/lib/ruby/vendor_ruby/unicorn/http_server.rb:660:in `worker_loop'
E, [2015-04-11T11:20:00.946073 #25817] ERROR -- : /usr/lib/ruby/vendor_ruby/unicorn/http_server.rb:527:in `spawn_missing_workers'
E, [2015-04-11T11:20:00.946095 #25817] ERROR -- : /usr/lib/ruby/vendor_ruby/unicorn/http_server.rb:153:in `start'
E, [2015-04-11T11:20:00.946114 #25817] ERROR -- : /usr/bin/unicorn:126:in `<main>'

有任何想法吗?

答案1

这似乎是安装的 unicorn 系统版本和 gem 版本的问题。为了修复这个问题,我刚刚做了

apt-get remove unicorn
gem install unicorn

之后问题就消失了

相关内容