我有这个问题,当我尝试推送到Heroku时,我得到的错误是
/tmp/build_c6e60f96-b7c3-4985-b3e0-d97e3a8408a8/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec'
/tmp/build_c6e60f96-b7c3-4985-b3e0-d97e3a8408a8/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run'
/tmp/build_c6e60f96-b7c3-4985-b3e0-d97e3a8408a8/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
/tmp/build_c6e60f96-b7c3-4985-b3e0-d97e3a8408a8/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializers'
/tmp/build_c6e60f96-b7c3-4985-b3e0-d97e3a8408a8/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!'
/tmp/build_c6e60f96-b7c3-4985-b3e0-d97e3a8408a8/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
/tmp/build_c6e60f96-b7c3-4985-b3e0-d97e3a8408a8/config/environment.rb:5:in `<top (required)>'
/tmp/build_c6e60f96-b7c3-4985-b3e0-d97e3a8408a8/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
/tmp/build_c6e60f96-b7c3-4985-b3e0-d97e3a8408a8/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
/tmp/build_c6e60f96-b7c3-4985-b3e0-d97e3a8408a8/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
/tmp/build_c6e60f96-b7c3-4985-b3e0-d97e3a8408a8/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
/tmp/build_c6e60f96-b7c3-4985-b3e0-d97e3a8408a8/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:189:in `require_environment!'
/tmp/build_c6e60f96-b7c3-4985-b3e0-d97e3a8408a8/vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:249:in `block in run_tasks_blocks'
/tmp/build_c6e60f96-b7c3-4985-b3e0-d97e3a8408a8/vendor/bundle/ruby/2.0.0/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:54:in `block (2 levels) in define'
Tasks: TOP => environment
(See full trace by running task with --trace)
!
! Precompiling assets failed.
!
! Push rejected, failed to compile Ruby app
答案 0 :(得分:0)
在config.assets.initialize_on_precompile = flase
config/application.rb
Heroku要求这是假的
答案 1 :(得分:0)
好吧,如果您使用rails 4x,则根本不需要为Heroku更改任何配置文件。
你所要做的就是添加这个宝石:
gem 'rails_12factor', group: :production
它会更改您的配置以符合Heroku对您的要求。如果这不起作用,我会仔细检查我的application.css或application.js是否需要不存在的资产。尝试在本地编译资产。