Getting Error while pushing into Heroku (Precompiling assets failed.)

Maybe you had already used rails_12_factor gem in your project, if not, remember to add it in your Gemfile as :production group.

gem 'rails_12factor', group: :production  

This gem enables serving assets in production and setting your logger to standard out, both of which are required to run a Rails 4 application on a twelve-factor provider. The gem also makes the appropriate changes for Rails 3 apps.

Maybe you want to attend a Deprecation Warning like:

DEPRECATION WARNING: The configuration option config.serve_static_assets has been renamed to config.serve_static_files to clarify its role.

Go to config/environments/production.rb

Then you can update serve_static_assets to serve_static_files

But if after these changes you were not able to push to heroku, maybe is because you are having an issue in your css code or somewhere else.

Use rake assets:precompile on production environment.

RAILS_ENV=production bundle exec rake assets:precompile  

And you can figure that out about your issue and receive feedback something like:

rake aborted!  
Sass::SyntaxError: Invalid CSS after "...ible !important": expected ";", was "!;"  

Fix that issue or those issues, and there you go, you are ready to push to Heroku.

Victor Velazquez

Coder, Musician, Startups, Passionate Dancer & Life Lover. Software Engineer at MagmaLabs, Co-founder of Web Dev Talks, Co-founder of Voltaire, Co-founder of Paqkit, Ex-co-founder of Zaznova.

Subscribe to The zazvick's blog

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!