0

我很难在 Heroku 上运行我的应用程序 - 该应用程序在我的本地机器上运行完美。:( 日志报告了我的 ActiveSupport gem 的一些问题。所以,我采取了这些措施:

1) 重新安装 ActiveSupport gem 2) 将我的 Git 提交回滚到之前工作正常的提交。3) 将我的应用程序复制到一个新文件夹 - 创建了一个新的 Git Repo,bundle install在新文件夹中执行,提交,添加 Heroku 远程源,将应用程序推送到 Heroku - 没有帮助。

我的 Rails 版本:3.0.3 Ruby:1.8.7

这是我的 Heroku 日志(已更新)

令人惊讶的是,我在 ./bundle/gems/ruby/1.9.1 之后得到了 1.9.1,而该项目使用的是 Ruby 1.8.7。有什么想法可以解决这个问题吗?

    2011-07-08T00:42:53+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 -- errors_helper (LoadError)
2011-07-08T00:42:53+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-07-08T00:42:53+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-07-08T00:42:53+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-07-08T00:42:53+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-07-08T00:42:53+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-07-08T00:42:53+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-07-08T00:42:53+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-07-08T00:42:53+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-07-08T00:42:53+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-07-08T00:42:53+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-07-08T00:42:53+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-07-08T00:42:53+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-07-08T00:42: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 `each'
2011-07-08T00:42: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-07-08T00:42: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-07-08T00:42: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-07-08T00:42:53+00:00 app[web.1]:   from /app/config/environment.rb:5:in `<top (required)>'
2011-07-08T00:42:53+00:00 app[web.1]:   from <internal:lib/rubygems/custom_require>:29:in `require'
2011-07-08T00:42:53+00:00 app[web.1]:   from <internal:lib/rubygems/custom_require>:29:in `require'
2011-07-08T00:42:53+00:00 app[web.1]:   from config.ru:3:in `block (3 levels) in <main>'
2011-07-08T00:42:53+00:00 app[web.1]:   from /home/heroku_rack/heroku.ru:23:in `eval'
2011-07-08T00:42:53+00:00 app[web.1]:   from /home/heroku_rack/heroku.ru:23:in `block (3 levels) in <main>'
2011-07-08T00:42:53+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.3/lib/rack/builder.rb:46:in `instance_eval'
2011-07-08T00:42:53+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.3/lib/rack/builder.rb:46:in `initialize'
2011-07-08T00:42:53+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.3/lib/rack/builder.rb:63:in `new'
2011-07-08T00:42:53+00:00 app[web.1]:   from /app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.3/lib/rack/builder.rb:63:in `map'
4

2 回答 2

1

如果您使用的是 Rails 3x,则应该使用 ruby​​gems 1.9.2,而不是 1.8.7。如果您在 rails 2x 和 Gemfile 上,还要确保在 environment.rb 中声明了正确的 rails 版本。

所以对于rails 2x项目

环境.rb

RAILS_GEM_VERSION = '2.3.8' unless defined? RAILS_GEM_VERSION

宝石文件

gem 'rails', '2.3.8'

对于 rails 3x 项目

宝石文件

gem 'rails', '3.0.7'

这样,heroku 就知道要在哪个 gem 集下加载哪个 rails 版本。你应该能够

git push heroku master

如果一切都理顺了

于 2011-07-08T00:02:25.467 回答
-1

好的,我已经解决了这个问题。我想为此从世界上最高的建筑中跳下来。自上周以来,我一直在为此苦苦挣扎。

我的app/helpers目录中有一个文件errors_helper.rb名为errors_helper.rb.rb

更改名称扩展名解决了我的问题!

于 2011-07-08T02:37:48.647 回答