I'm new in Rails development and this is my first deployment to Heroku. When I execute my application (after the deployment) there is an error:
2011-09-18T21:05:54+00:00 app[web.1]: Completed 500 Internal Server Error in 10ms
2011-09-18T21:05:54+00:00 app[web.1]:
2011-09-18T21:05:54+00:00 app[web.1]: ActionView::Template::Error (application.css isn't precompiled):
I googled this and found that I have to precompile my assets, but when trying to do this I found an other error:
$ bundle exec rake assets:precompile RAILS_ENV=production
rake aborted!
No such process - /usr/lib/ruby/gems/1.8/gems/pg-0.11.0/lib/pg_ext.so
(See full trace by running task with --trace)
I haven't found any solution for this issue. Is there anyone who faced this an know how to solve this problem?
The Rails asset pipeline provides an assets:precompile rake task to allow assets to be compiled and cached up front rather than compiled every time the app boots. There are two ways you can use the asset pipeline on Heroku. Compiling assets locally. Compiling assets during slug compilation.
The asset pipeline is implemented by the sprockets-rails gem, and is enabled by default. You can disable it while creating a new application by passing the --skip-asset-pipeline option. The sassc-rails gem is automatically used for CSS compression if included in the Gemfile and no config. assets.
I ran into this issue as well and I resolved it by doing the following:
Open up config/environments/production.rb
and make sure the following option is set to true
:
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = true
Then run:
rake assets:precompile --trace RAILS_ENV=production
Hope this helps!
~Kevin
I got the problem too. But you can
rake assets:precompile RAILS_ENV=production
in local, and push to heroku with public/assets. It's resolved.
I would recommend to use the new Cedar stack. It precompiles assets for you on deploy and overall plays nicer with Rails 3.1, although you will need to configure your app a little bit to work: add some gems to your Gemfile and create a Procfile. But it is still an easier way to go.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With