2011-03-22 56 views
1

因此,我已經在開發和生產環境中本地測試了我的應用程序,並且在推向Heroku之前似乎一切正常。當我檢查在Heroku上的日誌,我得到如下:Heroku應用程序崩潰與包含模塊

2011-03-21T22:37:42-07:00 heroku[slugc]: Slug compilation started 
    2011-03-21T22:38:43-07:00 heroku[api]: Deploy f9bb672 by [email protected] 
    2011-03-21T22:38:43-07:00 heroku[web.1]: State changed from created to starting 
    2011-03-21T22:38:43-07:00 heroku[slugc]: Slug compilation finished 
    2011-03-21T22:38:46-07:00 app[web.1]: /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/app/controllers/songs_controller.rb:2: uninitialized constant SongsController::Utils (NameError) 
    2011-03-21T22:38:46-07:00 app[web.1]: from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/engine.rb:138:in `eager_load!' 
    2011-03-21T22:38:46-07:00 app[web.1]: from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/engine.rb:137:in `each' 
    2011-03-21T22:38:46-07:00 app[web.1]: from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/engine.rb:137:in `eager_load!' 
    2011-03-21T22:38:46-07:00 app[web.1]: from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/engine.rb:135:in `each' 
    2011-03-21T22:38:46-07:00 app[web.1]: from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/engine.rb:135:in `eager_load!' 
    2011-03-21T22:38:46-07:00 app[web.1]: from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application.rb:108:in `eager_load!' 
    2011-03-21T22:38:46-07:00 app[web.1]: from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application/finisher.rb:41 
    2011-03-21T22:38:46-07:00 app[web.1]: from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:25:in `instance_exec' 
    2011-03-21T22:38:46-07:00 app[web.1]: from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:25:in `run' 
    2011-03-21T22:38:46-07:00 app[web.1]: from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:50:in `run_initializers' 
    2011-03-21T22:38:46-07:00 app[web.1]: from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:49:in `each' 
    2011-03-21T22:38:46-07:00 app[web.1]: from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:49:in `run_initializers' 
    2011-03-21T22:38:46-07:00 app[web.1]: from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application.rb:134:in `initialize!' 
    2011-03-21T22:38:46-07:00 app[web.1]: from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application.rb:77:in `send' 
    2011-03-21T22:38:46-07:00 app[web.1]: from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application.rb:77:in `method_missing' 
    2011-03-21T22:38:46-07:00 app[web.1]: from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/config/environment.rb:5 
    2011-03-21T22:38:46-07:00 app[web.1]: from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' 
    2011-03-21T22:38:46-07:00 app[web.1]: from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' 
    2011-03-21T22:38:46-07:00 app[web.1]: from config.ru:3 
    2011-03-21T22:38:46-07:00 app[web.1]: from /home/heroku_rack/heroku.ru:23 
    2011-03-21T22:38:46-07:00 app[web.1]: from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval' 
    2011-03-21T22:38:46-07:00 app[web.1]: from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize' 
    2011-03-21T22:38:46-07:00 app[web.1]: from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:63:in `new' 
    2011-03-21T22:38:46-07:00 app[web.1]: from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:63:in `map' 
    2011-03-21T22:38:46-07:00 app[web.1]: from /home/heroku_rack/heroku.ru:18 
    2011-03-21T22:38:46-07:00 app[web.1]: from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval' 
    2011-03-21T22:38:46-07:00 app[web.1]: from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize' 
    2011-03-21T22:38:46-07:00 app[web.1]: from /home/heroku_rack/heroku.ru:11:in `new' 
    2011-03-21T22:38:46-07:00 app[web.1]: from /home/heroku_rack/heroku.ru:11 
    2011-03-21T22:38:46-07:00 app[web.1]: from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval' 
    2011-03-21T22:38:46-07:00 app[web.1]: from /app/64e16569-bd45-4a40-b4af-ff9a339c1ef1/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize' 
    2011-03-21T22:38:46-07:00 app[web.1]: from /home/heroku_rack/heroku.ru:1:in `new' 
    2011-03-21T22:38:46-07:00 app[web.1]: from /home/heroku_rack/heroku.ru:1 
    2011-03-21T22:38:46-07:00 heroku[web.1]: State changed from starting to crashed 
    2011-03-21T22:38:46-07:00 heroku[web.1]: State changed from crashed to created 
    2011-03-21T22:38:47-07:00 heroku[web.1]: State changed from created to starting 
    2011-03-21T22:38:49-07:00 app[web.1]: /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/app/controllers/songs_controller.rb:2: uninitialized constant SongsController::Utils (NameError) 
    2011-03-21T22:38:49-07:00 app[web.1]: from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/engine.rb:138:in `eager_load!' 
    2011-03-21T22:38:49-07:00 app[web.1]: from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/engine.rb:137:in `each' 
    2011-03-21T22:38:49-07:00 app[web.1]: from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/engine.rb:137:in `eager_load!' 
    2011-03-21T22:38:49-07:00 app[web.1]: from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/engine.rb:135:in `each' 
    2011-03-21T22:38:49-07:00 app[web.1]: from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/engine.rb:135:in `eager_load!' 
    2011-03-21T22:38:49-07:00 app[web.1]: from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application.rb:108:in `eager_load!' 
    2011-03-21T22:38:49-07:00 app[web.1]: from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application/finisher.rb:41 
    2011-03-21T22:38:49-07:00 app[web.1]: from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:25:in `instance_exec' 
    2011-03-21T22:38:49-07:00 app[web.1]: from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:25:in `run' 
    2011-03-21T22:38:49-07:00 app[web.1]: from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:50:in `run_initializers' 
    2011-03-21T22:38:49-07:00 app[web.1]: from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:49:in `each' 
    2011-03-21T22:38:49-07:00 app[web.1]: from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/initializable.rb:49:in `run_initializers' 
    2011-03-21T22:38:49-07:00 app[web.1]: from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application.rb:134:in `initialize!' 
    2011-03-21T22:38:49-07:00 app[web.1]: from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application.rb:77:in `send' 
    2011-03-21T22:38:49-07:00 app[web.1]: from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/railties-3.0.5/lib/rails/application.rb:77:in `method_missing' 
    2011-03-21T22:38:49-07:00 app[web.1]: from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/config/environment.rb:5 
    2011-03-21T22:38:49-07:00 app[web.1]: from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' 
    2011-03-21T22:38:49-07:00 app[web.1]: from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' 
    2011-03-21T22:38:49-07:00 app[web.1]: from config.ru:3 
    2011-03-21T22:38:49-07:00 app[web.1]: from /home/heroku_rack/heroku.ru:23 
    2011-03-21T22:38:49-07:00 app[web.1]: from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval' 
    2011-03-21T22:38:49-07:00 app[web.1]: from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize' 
    2011-03-21T22:38:49-07:00 app[web.1]: from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:63:in `new' 
    2011-03-21T22:38:49-07:00 app[web.1]: from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:63:in `map' 
    2011-03-21T22:38:49-07:00 app[web.1]: from /home/heroku_rack/heroku.ru:18 
    2011-03-21T22:38:49-07:00 app[web.1]: from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval' 
    2011-03-21T22:38:49-07:00 app[web.1]: from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize' 
    2011-03-21T22:38:49-07:00 app[web.1]: from /home/heroku_rack/heroku.ru:11:in `new' 
    2011-03-21T22:38:49-07:00 app[web.1]: from /home/heroku_rack/heroku.ru:11 
    2011-03-21T22:38:49-07:00 app[web.1]: from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval' 
    2011-03-21T22:38:49-07:00 app[web.1]: from /app/4a26714e-2049-432b-9d67-c77edfe3c07c/home/.bundle/gems/ruby/1.8/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize' 
    2011-03-21T22:38:49-07:00 app[web.1]: from /home/heroku_rack/heroku.ru:1:in `new' 
    2011-03-21T22:38:49-07:00 app[web.1]: from /home/heroku_rack/heroku.ru:1 
    2011-03-21T22:38:50-07:00 heroku[web.1]: State changed from starting to crashed 
    2011-03-21T22:39:00-07:00 heroku[rake.1]: State changed from created to starting 
    2011-03-21T22:39:06-07:00 heroku[rake.1]: State changed from starting to complete 
    2011-03-21T22:39:10-07:00 heroku[router]: Error H10 (App crashed) -> GET blazing-dawn-282.heroku.com/ dyno=none queue=0 wait=0ms service=0ms bytes=0 
    2011-03-21T22:39:10-07:00 heroku[nginx]: GET/HTTP/1.1 | 173.51.104.168 | 796 | http | 503 
    2011-03-21T22:39:10-07:00 heroku[router]: Error H10 (App crashed) -> GET blazing-dawn-282.heroku.com/favicon.ico dyno=none queue=0 wait=0ms service=0ms bytes=0 
    2011-03-21T22:39:10-07:00 heroku[nginx]: GET /favicon.ico HTTP/1.1 | 173.51.104.168 | 795 | http | 503 

我假設這是因爲我想包括我在一個名爲utils的我的/ lib目錄下創建的模塊。

在我控制我執行以下操作:

include Utils 

的文件名Utils.rb和模塊的結構是:

module Utils 
     def some_function 
     end 
    end 

不知道問題是什麼,但我已採取以下步驟:

  • 將config.autoload_paths + =%W(#{config.root}/lib)添加到我的application.rb文件
  • 設置config.serve_static_assets =以來我的一些CSS和JavaScript的我production.rb文件真沒有被正確發送
  • 確保運行的Heroku耙分貝:遷移
  • 確保我推的最新版本從git到heroku

基本上我用盡了想法,我真的很想解決這個問題,任何幫助將不勝感激。謝謝!

+0

我發現以下問題對我有幫助:http://stackoverflow.com/questions/4074830/adding-lib-to-config-autoload-paths-in-rails-3-does-not-autoload我的模塊,但我會嘗試@ Rishav的建議,並在早上回到這個。 – alvincrespo 2011-03-22 06:34:47

回答

1

請確保文件名是utils.rb而不是Utils.rb

+0

會做什麼,我會測試下。謝謝! – alvincrespo 2011-03-22 06:34:15