Phusion Passenger问题:“Ruby(Rack)应用程序无法启动”

时间:2011-02-20 11:10:24

标签: ruby-on-rails ruby apache ruby-on-rails-3 passenger

制作sudo port install curl-ca-bundle link后,我开始遇到问题,但我不知道它是否是由curl-ca-bundle引起的。

我有这个问题:

Ruby (Rack) application could not be started

These are the possible causes:

    *
      There may be a syntax error in the application's code. Please check for such errors and fix them.
    *
      A required library may not installed. Please install all libraries that this application requires.
    *
      The application may not be properly configured. Please check whether all configuration files are written correctly, fix any incorrect configurations, and restart this application.
    *
      A service that the application relies on (such as the database server or the Ferret search engine server) may not have been started. Please start that service.

Further information about the error may have been written to the application's log file. Please check it in order to analyse the problem.

Error message:
    uninitialized constant Rack::ResponseTimer
Exception class:
    NameError
Application root:
    /Users/<my_user_name>/Sites/pjtname.com/pjtname.com 

Backtrace:
    #   File    Line    Location
    0   /Users/<my_user_name>/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/inflector/methods.rb    124     in `block in constantize'
    1   /Users/<my_user_name>/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/inflector/methods.rb    123     in `each'
    2   /Users/<my_user_name>/.rvm/gems/ruby-1.9.2-p136/gems/activesupport-3.0.3/lib/active_support/inflector/methods.rb    123     in `constantize'
    3   /Users/<my_user_name>/.rvm/gems/ruby-1.9.2-p136/gems/actionpack-3.0.3/lib/action_dispatch/middleware/stack.rb   14  in `klass'
    4   /Users/<my_user_name>/.rvm/gems/ruby-1.9.2-p136/gems/actionpack-3.0.3/lib/action_dispatch/middleware/stack.rb   33  in `build'
    5   /Users/<my_user_name>/.rvm/gems/ruby-1.9.2-p136/gems/actionpack-3.0.3/lib/action_dispatch/middleware/stack.rb   79  in `block in build'
    6   /Users/<my_user_name>/.rvm/gems/ruby-1.9.2-p136/gems/actionpack-3.0.3/lib/action_dispatch/middleware/stack.rb   79  in `each'
    7   /Users/<my_user_name>/.rvm/gems/ruby-1.9.2-p136/gems/actionpack-3.0.3/lib/action_dispatch/middleware/stack.rb   79  in `inject'
    8   /Users/<my_user_name>/.rvm/gems/ruby-1.9.2-p136/gems/actionpack-3.0.3/lib/action_dispatch/middleware/stack.rb   79  in `build'
    9   /Users/<my_user_name>/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/application.rb    162     in `app'
    10  /Users/<my_user_name>/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/application/finisher.rb   35  in `block in '
    11  /Users/<my_user_name>/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/initializable.rb  25  in `instance_exec'
    12  /Users/<my_user_name>/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/initializable.rb  25  in `run'
    13  /Users/<my_user_name>/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/initializable.rb  50  in `block in run_initializers'
    14  /Users/<my_user_name>/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/initializable.rb  49  in `each'
    15  /Users/<my_user_name>/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/initializable.rb  49  in `run_initializers'
    16  /Users/<my_user_name>/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/application.rb    134     in `initialize!'
    17  /Users/<my_user_name>/.rvm/gems/ruby-1.9.2-p136/gems/railties-3.0.3/lib/rails/application.rb    77  in `method_missing'
    18  /Users/<my_user_name>/Sites/pjtname.com/pjtname.com/config/environment.rb   5   in `'
    19  config.ru   3   in `require'
    20  config.ru   3   in `block in '
    21  /Users/<my_user_name>/.rvm/gems/ruby-1.9.2-p136/gems/rack-1.2.1/lib/rack/builder.rb     46  in `instance_eval'
    22  /Users/<my_user_name>/.rvm/gems/ruby-1.9.2-p136/gems/rack-1.2.1/lib/rack/builder.rb     46  in `initialize'
    23  config.ru   1   in `new'
    24  config.ru   1   in `'

所以,在终端我试图运行

gem update

所有宝石都已更新,但不包括:

Updating text-hyphen
ERROR:  Error installing text-hyphen:
    text-hyphen requires Ruby version < 1.9.

运行

which ruby

导致

/Users/<my_user_name>/.rvm/rubies/ruby-1.9.2-p136/bin/ruby

运行

ruby -v

导致

ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.5.0]

运行

gem list

导致

*** LOCAL GEMS ***

abstract (1.0.0)
actionmailer (3.0.4, 3.0.3, 3.0.1)
actionpack (3.0.4, 3.0.3, 3.0.1)
activemodel (3.0.4, 3.0.3, 3.0.1)
activerecord (3.0.4, 3.0.3, 3.0.1)
activeresource (3.0.4, 3.0.3, 3.0.1)
activesupport (3.0.4, 3.0.3, 3.0.1)
always_verify_ssl_certificates (0.2.0)
arel (2.0.8, 2.0.7, 2.0.6, 1.0.1)
bartt-ssl_requirement (1.2.4)
builder (3.0.0, 2.1.2)
bundler (1.0.10, 1.0.7)
daemon_controller (0.2.6, 0.2.5)
erubis (2.6.6)
fastthread (1.0.7)
file-tail (1.0.5)
i18n (0.5.0, 0.4.2)
mail (2.2.15, 2.2.14, 2.2.13, 2.2.10)
memcache-client (1.8.5)
mime-types (1.16)
mysql2 (0.2.6)
paperclip (2.3.8)
passenger (3.0.2)
polyglot (0.3.1)
rack (1.2.1)
rack-mount (0.6.13)
rack-test (0.5.7, 0.5.6)
rails (3.0.4, 3.0.3, 3.0.1)
railties (3.0.4, 3.0.3, 3.0.1)
rake (0.8.7)
rubygems-update (1.5.2, 1.4.2)
sinatra (1.1.3, 1.1.2)
spruz (0.2.5, 0.2.2)
text-format (1.0.0)
text-hyphen (1.0.0)
thor (0.14.6)
tilt (1.2.2)
treetop (1.4.9)
tzinfo (0.3.24, 0.3.23)



安装curl-ca-bundle之前,所有人都使用以下语句。


config.ru文件中:

# This file is used by Rack-based servers to start the application.

    require ::File.expand_path('../config/environment',  __FILE__)
    run PjtnameCom::Application

ROOT_RAILS/conf/application.rb

module PjtnameCom
  class Application < Rails::Application
    # Configure middlewares
    config.middleware.use "Rack::ResponseTimer"
    ...
  end
end

注意:如果我删除它config.middleware.use "Rack::ResponseTimer",它就会起作用。


ROOT_RAILS/libs/rack/response_timer.rb

module Rack
  class ResponseTimer
    def initialize(app)
      @app = app
    end

    def call(env)
      status, headers, response = @app.call(env)
      [status, headers, response]
    end
  end
end

这是什么错误?我该如何解决?我必须重新安装Phusion Passenger?

我用:

  • Mac Os跑“Snow Leopard”10.6.6

  • Ruby版本管理器(RVM)

  • 的Apache

  • Ruby on Rails v3.0.3(也许我必须升级到v 3.0.4?

P.S。:如果您需要其他信息,请与我们联系。

1 个答案:

答案 0 :(得分:1)

<强>解决


RAILS_ROOT/config/application.rb中,我忘记了(!!!!!)

# Custom directories with classes and modules you want to be autoloadable.
# config.autoload_paths += %W(#{config.root}/extras)
config.autoload_paths += %W(#{config.root}/lib)