【问题标题】:Phusion Passenger problem: "Ruby (Rack) application could not be started"Phusion 乘客问题:“无法启动 Ruby (Rack) 应用程序”
【发布时间】:2011-02-20 11:10:24
【问题描述】:

做了sudo port install curl-ca-bundlelink之后就开始有问题了,不知道是不是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 运行“雪豹”10.6.6

  • Ruby 版本管理器 (RVM)

  • 阿帕奇

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

P.S.:如果您需要其他信息,请告诉我。

【问题讨论】:

  • 为什么你使用config.middleware.use "Rack::ResponseTimer"
  • 这是来自railscasts.com的一个简单例子
  • 那么 test-hyphen 是否与 1.9 兼容,在这里?

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


【解决方案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)

【讨论】:

    猜你喜欢
    • 2012-10-15
    • 2014-03-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多