-
Notifications
You must be signed in to change notification settings - Fork 202
Precompilation fails on Heroku #29
Conversation
I'm also having the same issue. The only thing that works for me is to change initialize_on_precompile to true: This will mean we have to precompile locally and deal with conflicts instead of compiling on heroku. :( Any help is much appreciated. :) -Ben |
This is the workaround I use for now. If it helps anyone, here is the command to use locally: Then commit the changes to Heroku (that will skip precompilation). |
At this point, compiling on Heroku does not appear to be an option. Currently, @benbabics, you can avoid conflicts with the workaround from @karellm. In short, never commit built assets for any branch except a dedicated Heroku-deployment branch. Keep a
Likewise, if you use a CI server you could configure it to automatically update I'm leaving this issue open until workaround(s) are better documented in the README and/or the wiki. |
I need to switch to other tasks right now, but I'm going to dig into this again tomorrow for a bit. Rails' source code claims that when precompilation is occuring and Of course, even if I can work around that problem, Heroku itself is another matter. The elephant in the corner is whether a useful version of |
Thanks for your help on this. Heroku can compile using your plugin (it allows node app). Everything was working fine up until I started using devise in my routes. Strangely the asset precompilation loads the routes and it was causing a database error on Heroku because the devise line in my routes was calling the db. So if there is no call to the db whatsoever during the |
That's great. I have an app that I'm planning to push to Heroku, so it's good to know that the gem works there. I'll have a look tomorrow and see if I can sort out how the rake task can pick up the |
I found a hacky workaround to duplicate-init issue. Put this at bottom of your Rakefile
Sprockets will shell out to a new rake process if either RAILS_GROUPS or RAILS_ENV is empty. It will start from scratch so the processes init isn't duplicate. After the rakefile loads config/application we shouldn't need RAILS_GROUPS any more. |
Building with `config.assets.initialize_on_precompile = false` now works. This enables building on Heroku, builds with Devise, etc.
Fix precompilation problems on Heroku
Hi,
Heroku requires this line for deployment:
config.assets.initialize_on_precompile = false
It causes
rake assets:precompile
to fail. Here is the trace: