错误:推送到Heroku时未初始化的常量Sprockets :: Helpers

时间:2013-12-05 05:49:30

标签: ruby-on-rails heroku amazon-web-services carrierwave sprockets

我刚安装了carrierwave,并设置了我的rails 4应用程序,以便通过雾在亚马逊s3上存储图像。该应用程序正在使用Carrierwave工作并部署到Heroku(但图像正在用dyno清除)。在一些初始问题之后,我让它在我的本地主机上运行(据我所知)。

现在我无法将新版本推送到Heroku。我重置了DATABASE。预编译资产,现在尝试迁移数据库。以下是我得到的错误。

Running `rake db:migrate` attached to terminal... up, run.6517
rake aborted!
uninitialized constant Sprockets::Helpers
/app/app/uploaders/image_uploader.rb:12:in `<class:ImageUploader>'
/app/app/uploaders/image_uploader.rb:4:in `<top (required)>'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:465:in `block (2 levels) in eager_load!'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:464:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:464:in `block in eager_load!'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:462:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:462:in `eager_load!'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:347:in `eager_load!'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application/finisher.rb:56:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application/finisher.rb:56:in `block in <module:Finisher>'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializers'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
/app/config/environment.rb:5:in `<top (required)>'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:189:in `require_environment!'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:249:in `block in run_tasks_blocks'
Tasks: TOP => db:migrate => environment

我试图在Uploader文件中包含并不包含Sprockets,并以任何方式获得相同的错误。我知道链接器不再包含在Rails 4的主服务器中。我现在已经安装了sprockets-rails和sprockets-helper gem。我也试图在文件的顶部要求它们(我完全不理解这一点,但遵循这个建议https://github.com/petebrowne/sprockets-helpers)。没有任何效果。关于如何解决这个问题的任何建议。如何初始化Sprockets :: Helpers。感谢。

1 个答案:

答案 0 :(得分:0)

我犯了一个非常愚蠢的错误。我已经更正了我的应用程序中的文件,并将更改提交给主服务器,但我继续运行heroku运行rake db:migrate命令并得到相同的错误,所以我认为我还没有解决它。我忘了把新版推到heroku!因此仍然得到相同错误的原因。

此外,如果其他人有类似的问题。确保你已经解决了这个问题:

https://github.com/carrierwaveuploader/carrierwave/issues/1020