Rails应用程序在本地工作,在Heroku上崩溃

问题描述:

我一直在试图找出日志中出了什么问题,但不知道如何解决它。以下是日志中的片段,我对如何修复有些困惑。任何帮助将不胜感激。Rails应用程序在本地工作,在Heroku上崩溃

Could not load SystemTimer >= v1.2.0. Falling back to timeout.rb. SystemTimer is STRONGLY recommended for timeouts in Ruby 1.8.7. See http://ph7spot.com/blog/system-timer-1-2-release for details. 

/app/.bundle/gems/ruby/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:306:in `depend_on': No such file to load -- spec_helper (LoadError) 

,这是在日志

from /app/.bundle/gems/ruby/1.8/gems/railties-3.1.0/lib/rails/initializable.rb:49:in `run_initializers' 

根据捆绑的,下面的宝石正在使用

据包安装的顶部,下面的宝石被安装

使用rake(0.9.2) 使用摘要(1.0.0) 使用activesupport(3.0.3) 使用构建器使用I18N(2.1.2) 使用activemodel的(0.6.0) 使用erubis(3.0.3) (2.6.6) 使用齿条(1.2.4) 使用机架式(0.6.14) 使用齿条 - 试验(0.5.7) 使用tzinfo(0.3.29) 使用ActionPack的(3.0.3) 使用MIME类型(1.16) 使用多语种(0.3.2) 使用树梢(1.4.10) 使用邮件使用的ActionMailer(2.2.19) 使用AREL(3.0.3) 使用ActiveRecord(2.0.10) 使用的ActiveResource(3.0.3) 使用BSON(3.0.3) (1.3.1) 使用bson_ext(1.3 0.1) 使用捆绑(1.0.18) 使用carrierwave(0.5.7) 使用EXCON(0.6.6) 使用formatador(0.2.1) 使用multi_json(1.0.3) 使用net-SSH(2.1.4) 使用net-SCP(1.0.4) 使用引入nokogiri(1.5.0) 使用红宝石-HMAC(0.4.0) 使用雾(0.11.0) 使用formtastic(1.2.4) 使用蒙戈(1.3。 1) 使用勇敢(0.3.8) 使用mongo_mapper(0.9.2) 使用托尔(0.14.6) 使用railties(3.0.3) 使用导轨(3.0.3) 使用Rails3中发电机(0.17。 4)

下面是完整的Heroku的日志

2011-09-19T00:19:53+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `run_initializers' 
2011-09-19T00:19:53+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.3/lib/rails/application.rb:134:in `initialize!' 
2011-09-19T00:19:53+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.3/lib/rails/application.rb:77:in `method_missing' 
2011-09-19T00:19:53+00:00 app[web.1]: from /app/config/environment.rb:5:in `<top (required)>' 
2011-09-19T00:19:53+00:00 app[web.1]: from <internal:lib/rubygems/custom_require>:29:in `require' 
2011-09-19T00:19:53+00:00 app[web.1]: from <internal:lib/rubygems/custom_require>:29:in `require' 
2011-09-19T00:19:53+00:00 app[web.1]: from config.ru:3:in `block (3 levels) in <main>' 
2011-09-19T00:19:53+00:00 app[web.1]: from /home/heroku_rack/heroku.ru:23:in `eval' 
2011-09-19T00:19:53+00:00 app[web.1]: from /home/heroku_rack/heroku.ru:23:in `block (3 levels) in <main>' 
2011-09-19T00:19:53+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval' 
2011-09-19T00:19:53+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize' 
2011-09-19T00:19:53+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:63:in `new' 
2011-09-19T00:19:53+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:63:in `map' 
2011-09-19T00:19:53+00:00 app[web.1]: from /home/heroku_rack/heroku.ru:18:in `block (2 levels) in <main>' 
2011-09-19T00:19:53+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval' 
2011-09-19T00:19:53+00:00 heroku[web.1]: Process exited 
2011-09-19T00:19:53+00:00 heroku[web.1]: State changed from starting to crashed 
2011-09-19T00:31:24+00:00 heroku[web.1]: State changed from crashed to created 
2011-09-19T00:31:24+00:00 heroku[web.1]: State changed from created to starting 
2011-09-19T00:31:27+00:00 heroku[web.1]: Starting process with command `thin -p 42871 -e production -R /home/heroku_rack/heroku.ru start` 
2011-09-19T00:31:31+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:304:in `rescue in depend_on': No such file to load -- spec_helper (LoadError) 
2011-09-19T00:31:31+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:299:in `depend_on' 
2011-09-19T00:31:31+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:216:in `require_dependency' 
2011-09-19T00:31:31+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.3/lib/rails/engine.rb:138:in `block (2 levels) in eager_load!' 
2011-09-19T00:31:31+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.3/lib/rails/engine.rb:137:in `each' 
2011-09-19T00:31:31+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.3/lib/rails/engine.rb:137:in `block in eager_load!' 
2011-09-19T00:31:31+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.3/lib/rails/engine.rb:135:in `each' 
2011-09-19T00:31:31+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.3/lib/rails/engine.rb:135:in `eager_load!' 
2011-09-19T00:31:31+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.3/lib/rails/application.rb:108:in `eager_load!' 
2011-09-19T00:31:31+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.3/lib/rails/application/finisher.rb:41:in `block in <module:Finisher>' 
2011-09-19T00:31:31+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `instance_exec' 
2011-09-19T00:31:31+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `run' 
2011-09-19T00:31:31+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.3/lib/rails/initializable.rb:50:in `block in run_initializers' 
2011-09-19T00:31:31+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `each' 
2011-09-19T00:31:31+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `run_initializers' 
2011-09-19T00:31:31+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.3/lib/rails/application.rb:134:in `initialize!' 
2011-09-19T00:31:31+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.3/lib/rails/application.rb:77:in `method_missing' 
2011-09-19T00:31:31+00:00 app[web.1]: from /app/config/environment.rb:5:in `<top (required)>' 
2011-09-19T00:31:31+00:00 app[web.1]: from <internal:lib/rubygems/custom_require>:29:in `require' 
2011-09-19T00:31:31+00:00 app[web.1]: from <internal:lib/rubygems/custom_require>:29:in `require' 
2011-09-19T00:31:31+00:00 app[web.1]: from config.ru:3:in `block (3 levels) in <main>' 
2011-09-19T00:31:31+00:00 app[web.1]: from /home/heroku_rack/heroku.ru:23:in `eval' 
2011-09-19T00:31:31+00:00 heroku[web.1]: Process exited 
2011-09-19T00:31:32+00:00 heroku[web.1]: State changed from starting to crashed 
2011-09-19T00:40:49+00:00 heroku[slugc]: Slug compilation started 
2011-09-19T00:40:59+00:00 heroku[api]: Deploy 50313f5 by [email protected] 
2011-09-19T00:40:59+00:00 heroku[api]: Release v5 created by [email protected] 
2011-09-19T00:40:59+00:00 heroku[web.1]: State changed from crashed to created 
2011-09-19T00:40:59+00:00 heroku[web.1]: State changed from created to starting 
2011-09-19T00:41:00+00:00 heroku[slugc]: Slug compilation finished 
2011-09-19T00:41:02+00:00 heroku[web.1]: Starting process with command `thin -p 22238 -e production -R /home/heroku_rack/heroku.ru start` 
2011-09-19T00:41:06+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:304:in `rescue in depend_on': No such file to load -- spec_helper (LoadError) 
2011-09-19T00:41:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:299:in `depend_on' 
2011-09-19T00:41:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:216:in `require_dependency' 
2011-09-19T00:41:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.3/lib/rails/engine.rb:138:in `block (2 levels) in eager_load!' 
2011-09-19T00:41:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.3/lib/rails/engine.rb:137:in `each' 
2011-09-19T00:41:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.3/lib/rails/engine.rb:137:in `block in eager_load!' 
2011-09-19T00:41:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.3/lib/rails/engine.rb:135:in `each' 
2011-09-19T00:41:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.3/lib/rails/engine.rb:135:in `eager_load!' 
2011-09-19T00:41:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.3/lib/rails/application.rb:108:in `eager_load!' 
2011-09-19T00:41:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.3/lib/rails/application/finisher.rb:41:in `block in <module:Finisher>' 
2011-09-19T00:41:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `instance_exec' 
2011-09-19T00:41:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.3/lib/rails/initializable.rb:25:in `run' 
2011-09-19T00:41:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.3/lib/rails/initializable.rb:50:in `block in run_initializers' 
2011-09-19T00:41:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `each' 
2011-09-19T00:41:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.3/lib/rails/initializable.rb:49:in `run_initializers' 
2011-09-19T00:41:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.3/lib/rails/application.rb:134:in `initialize!' 
2011-09-19T00:41:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.3/lib/rails/application.rb:77:in `method_missing' 
2011-09-19T00:41:06+00:00 app[web.1]: from /app/config/environment.rb:5:in `<top (required)>' 
2011-09-19T00:41:06+00:00 app[web.1]: from <internal:lib/rubygems/custom_require>:29:in `require' 
2011-09-19T00:41:06+00:00 app[web.1]: from <internal:lib/rubygems/custom_require>:29:in `require' 
2011-09-19T00:41:06+00:00 app[web.1]: from config.ru:3:in `block (3 levels) in <main>' 
2011-09-19T00:41:06+00:00 app[web.1]: from /home/heroku_rack/heroku.ru:23:in `eval' 
2011-09-19T00:41:06+00:00 app[web.1]: from /home/heroku_rack/heroku.ru:23:in `block (3 levels) in <main>' 
2011-09-19T00:41:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval' 
2011-09-19T00:41:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize' 
2011-09-19T00:41:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:63:in `new' 
2011-09-19T00:41:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:63:in `map' 
2011-09-19T00:41:06+00:00 app[web.1]: from /home/heroku_rack/heroku.ru:18:in `block (2 levels) in <main>' 
2011-09-19T00:41:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval' 
2011-09-19T00:41:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize' 
2011-09-19T00:41:06+00:00 app[web.1]: from /home/heroku_rack/heroku.ru:11:in `new' 
2011-09-19T00:41:06+00:00 app[web.1]: from /home/heroku_rack/heroku.ru:11:in `block in <main>' 
2011-09-19T00:41:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval' 
2011-09-19T00:41:06+00:00 app[web.1]: from /app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize' 
2011-09-19T00:41:06+00:00 app[web.1]: from /home/heroku_rack/heroku.ru:1:in `new' 
2011-09-19T00:41:06+00:00 app[web.1]: from /home/heroku_rack/heroku.ru:1:in `<main>' 
2011-09-19T00:41:06+00:00 app[web.1]: from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/rack/adapter/loader.rb:36:in `eval' 
2011-09-19T00:41:06+00:00 app[web.1]: from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/rack/adapter/loader.rb:36:in `load' 
2011-09-19T00:41:06+00:00 app[web.1]: from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/thin/controllers/controller.rb:175:in `load_rackup_config' 
2011-09-19T00:41:06+00:00 app[web.1]: from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/thin/controllers/controller.rb:65:in `start' 
2011-09-19T00:41:06+00:00 app[web.1]: from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/thin/runner.rb:177:in `run_command' 
2011-09-19T00:41:06+00:00 app[web.1]: from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/lib/thin/runner.rb:143:in `run!' 
2011-09-19T00:41:06+00:00 app[web.1]: from /usr/ruby1.9.2/lib/ruby/gems/1.9.1/gems/thin-1.2.6/bin/thin:6:in `<top (required)>' 
2011-09-19T00:41:06+00:00 app[web.1]: from /usr/ruby1.9.2/bin/thin:19:in `load' 
2011-09-19T00:41:06+00:00 app[web.1]: from /usr/ruby1.9.2/bin/thin:19:in `<main>' 
2011-09-19T00:41:06+00:00 heroku[web.1]: Process exited 
2011-09-19T00:41:07+00:00 heroku[web.1]: State changed from starting to crashed 

谢谢!

+0

你是如何解决这个问题的? –

+0

你有没有解决这个问题? – Jaqx

+0

是的,我不记得确切的解决方案,但我相信它是固定的,当我指定了我想要的确切宝石版本(heroku有较新的不兼容版本) – Kyle

我想问题可能是在这一行:

/app/.bundle/gems/ruby/1.8/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:306:in `depend_on': No such file to load -- spec_helper (LoadError) 

看来你的初始化的一个中有require "spec_helper"(或其他地方,做同样的加载文件),不应该。这可能与:test组中的Gemfile中的宝石有关,这些宝石默认情况下不会在Heroku中加载。

您可以尝试在本地运行bundle install --without test development来重现Heroku如何安装宝石。请注意,这将是捆绑安装宝石的永久方式,直到您从您的项目中删除./.bundle/config文件,所以您一旦想出来之后就会想要这样做。

希望这有助于...

+0

我无法找到任何需要“spec_helper”初始化程序:(我没有捆绑安装 - 没有测试开发,也没有发生错误 – Kyle

+0

应用程序在本地运行,但仍然失败heroku – Kyle

+0

@Kyle之后,你应该执行你的命令(比如'rails s '''rails c','rake something'),用'bundle exec'作为前缀,这样就完全复制了heroku env,否则你的命令仍然会看到“已卸载”的gems。 – Fabio

我有同样的事情。在开发过程中,一个spec不知何故被复制到控制器文件夹中。本地没有任何影响,但坠毁雪松...

+0

我认为你需要清楚你的问题以简单way.otherwise你的问题他解释创建另一个问题 – khan

+0

我只是花了大量的时间试图追查下来,你的答案解决了我的问题。我结束了搜索“spec_helper”的应用程序,发现我不小心将一个规格文件保存在模型文件夹中。 – nfriend21

与乘客有同样的问题。问题是依赖于lib的模型中的一个要求。将lib目录添加到自动加载并删除全部需要(通过fgrep 'require' -r app/找到)工作。