"Command failed with status ()" when precompiling assets
asset-pipeline, rake, ruby-on-rails, ruby-on-rails-3
Solution
I am going to answer this myself because I could solve it more or less. If someone has additions, don't hesitate to write an own answer or comment this answer/question.
What I've found out so far:
If you play around with `assets:precompile` by e.g just compiling the primary assets (`assets:precompile:primary`) or explicitly calling `assets:precompile:all` you might end up with a hint about the source of your problem. In my case, I ran into `Errno::EACCES` on both `public/` and `tmp/`. Somehow that was not displayed, so make sure your user has full rights to create/delete files and folders there.
In my case, it worked sometimes because I've shut down the rails app and precompiled while it was down. Since precompiling allocates a lot of memory, I did some trial and error and eventually got the known `Killed` message when rake tries to execute `asstes:precompile:primary`. The task simply was killed because of using too much memory.
Another problem was that sprockets could not find `bootstrap` to put it into the assets pipeline on precompilation. Moving `gem 'bootstrap'` outside of `group :assets` solved this. This was also something I got hinted to when I played around with the commands.
The best way to solve – or better: work around – this problem is to simply compile your assets locally. Just throw a `rake assets:precompile RAILS_ENV=development` into your terminal and then deploy `public/assets`. Remember to delete that folder in your development environment after deploying it or you will end up debugging on why your changes on `app/assets/*` are not taking effect in development. At least that works for me(tm).
Alternatively, growing your swap partition may also work. However, compilation on a VPS where you need to use swap may take its while, so I'd stick to the local way.
Problem
I am having similiar problems like a lot of users when compiling assets on their productive box. The only difference is that I can't get any hint out of the trace to solve the problem. ``` rake assets:precompile RAILS_ENV=production --trace ** Invoke assets:precompile (first_time) ** Execute assets:precompile /usr/local/rbenv/versions/1.9.3-p362/bin/ruby /usr/local/rbenv/versions/1.9.3-p362/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace ** Invoke assets:precompile:all (first_time) ** Execute assets:precompile:all ** Invoke assets:precompile:primary (first_time) ** Invoke assets:environment (first_time) ** Execute assets:environment ** Invoke environment (first_time) ** Execute environment ** Invoke tmp:cache:clear (first_time) ** Execute tmp:cache:clear ** Execute assets:precompile:primary rake aborted! Command failed with status (): [/usr/local/rbenv/versions/1.9.3-p362/bin/r...] /usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/file_utils.rb:53:in `block in create_shell_runner' /usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/file_utils.rb:45:in `call' /usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/file_utils.rb:45:in `sh' /usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/file_utils_ext.rb:39:in `sh' /usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/file_utils.rb:80:in `ruby' /usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/file_utils_ext.rb:39:in `ruby' /home/app/application/ruby/1.9.1/gems/actionpack-3.2.12/lib/sprockets/assets.rake:12:in `ruby_rake_task' /home/app/application/ruby/1.9.1/gems/actionpack-3.2.12/lib/sprockets/assets.rake:21:in `invoke_or_reboot_rake_task' /home/app/application/ruby/1.9.1/gems/actionpack-3.2.12/lib/sprockets/assets.rake:29:in `block (2 levels) in <top (required)>' /usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/task.rb:205:in `call' /usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/task.rb:205:in `block in execute' /usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/task.rb:200:in `each' /usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/task.rb:200:in `execute' /usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/task.rb:158:in `block in invoke_with_call_chain' /usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize' /usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/task.rb:151:in `invoke_with_call_chain' /usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/task.rb:144:in `invoke' /usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/application.rb:116:in `invoke_task' /usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/application.rb:94:in `block (2 levels) in top_level' /usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/application.rb:94:in `each' /usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/application.rb:94:in `block in top_level' /usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling' /usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/application.rb:88:in `top_level' /usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/application.rb:66:in `block in run' /usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling' /usr/local/rbenv/versions/1.9.3-p362/lib/ruby/1.9.1/rake/application.rb:63:in `run' /usr/local/rbenv/versions/1.9.3-p362/bin/rake:32:in `<main>' Tasks: TOP => assets:precompile ``` There is effectively no status code, just the fail. It also does not make any difference if I call rake directly or via `bundle exec`. About the environment debian squeeze box with a global rbenv installation (`/usr/local/rbenv` like you can see from the trace). Ruby 1.9.3 2012-12-25 patchlevel 362. Any hints / ideas on this?