Skip to content
This repository was archived by the owner on Jun 10, 2018. It is now read-only.
This repository was archived by the owner on Jun 10, 2018. It is now read-only.

Asset precompile works on development but fails on staging/production #41

Description

@mmustala

Im using JRuby and got tired of slow asset precompiling with the :uglifier and :sass compilers. I installed yui-compiler (0.12.0) and tried precompiling in development mode and it ran pretty fast. Everything was ok. Then when I deployed into our staging server with capistrano it threw an error.

  * executing "cd /home/staging/releases/20141218122233 && bundle exec rake RAILS_ENV=staging RAILS_GROUPS=assets assets:precompile"
    servers: ["5.9.144.199"]
    [5.9.144.199] executing command
*** [err :: 5.9.144.199] rake aborted!
*** [err :: 5.9.144.199] YUI::Compressor::RuntimeError: Command 'java -jar /home/staging/shared/bundle/jruby/1.9/gems/yui-compressor-0.12.0/lib/yui/../yuicompressor-2.4.8.jar --type js --charset utf-8 --nomunge /tmp/yui_compress20141218-31554-1h3vduh' returned non-zero exit status
*** [err :: 5.9.144.199] (in /home/staging/releases/20141218122233/app/assets/javascripts/application.js)
*** [err :: 5.9.144.199] /home/staging/shared/bundle/jruby/1.9/gems/yui-compressor-0.12.0/lib/yui/compressor.rb:106:in `compress'
*** [err :: 5.9.144.199] /home/staging/shared/bundle/jruby/1.9/gems/yui-compressor-0.12.0/lib/yui/compressor.rb:141:in `streamify'
*** [err :: 5.9.144.199] /home/staging/shared/bundle/jruby/1.9/gems/yui-compressor-0.12.0/lib/yui/compressor.rb:86:in `compress'
*** [err :: 5.9.144.199] /home/staging/shared/bundle/jruby/1.9/gems/sprockets-2.11.0/lib/sprockets/yui_compressor.rb:19:in `evaluate'
*** [err :: 5.9.144.199] /home/staging/shared/bundle/jruby/1.9/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
*** [err :: 5.9.144.199] /home/staging/shared/bundle/jruby/1.9/gems/sprockets-2.11.0/lib/sprockets/context.rb:197:in `evaluate'
*** [err :: 5.9.144.199] /home/staging/shared/bundle/jruby/1.9/gems/sprockets-2.11.0/lib/sprockets/context.rb:194:in `evaluate'
*** [err :: 5.9.144.199] /home/staging/shared/bundle/jruby/1.9/gems/sprockets-2.11.0/lib/sprockets/bundled_asset.rb:25:in `initialize'
*** [err :: 5.9.144.199] /home/staging/shared/bundle/jruby/1.9/gems/sprockets-2.11.0/lib/sprockets/base.rb:377:in `build_asset'
*** [err :: 5.9.144.199] /home/staging/shared/bundle/jruby/1.9/gems/sprockets-2.11.0/lib/sprockets/index.rb:94:in `build_asset'
*** [err :: 5.9.144.199] /home/staging/shared/bundle/jruby/1.9/gems/sprockets-2.11.0/lib/sprockets/caching.rb:58:in `cache_asset'
*** [err :: 5.9.144.199] /home/staging/shared/bundle/jruby/1.9/gems/sprockets-2.11.0/lib/sprockets/index.rb:93:in `build_asset'
*** [err :: 5.9.144.199] /home/staging/shared/bundle/jruby/1.9/gems/sprockets-2.11.0/lib/sprockets/base.rb:287:in `find_asset'
*** [err :: 5.9.144.199] /home/staging/shared/bundle/jruby/1.9/gems/sprockets-2.11.0/lib/sprockets/index.rb:61:in `find_asset'
*** [err :: 5.9.144.199] /home/staging/shared/bundle/jruby/1.9/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:211:in `find_asset'
*** [err :: 5.9.144.199] /home/staging/shared/bundle/jruby/1.9/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:257:in `benchmark'
*** [err :: 5.9.144.199] /home/staging/shared/bundle/jruby/1.9/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:210:in `find_asset'
*** [err :: 5.9.144.199] /home/staging/shared/bundle/jruby/1.9/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:119:in `compile'
*** [err :: 5.9.144.199] /home/staging/shared/bundle/jruby/1.9/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:118:in `compile'
*** [err :: 5.9.144.199] /home/staging/shared/bundle/jruby/1.9/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:60:in `define'
*** [err :: 5.9.144.199] /home/staging/shared/bundle/jruby/1.9/gems/sprockets-2.11.0/lib/rake/sprocketstask.rb:146:in `with_logger'
*** [err :: 5.9.144.199] /home/staging/shared/bundle/jruby/1.9/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:59:in `define'
*** [err :: 5.9.144.199] Tasks: TOP => assets:precompile
*** [err :: 5.9.144.199] (See full trace by running task with --trace)
    command finished in 20347ms
*** [deploy:update_code] rolling back

I have JAVA_HOME set in the capistrano deploy.rb and also in the .profile file.

set :default_environment, {
    'JAVA_HOME' => '$HOME/java'
}

What could cause that in development environment the same file is successfully compressed but in other environment is not?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions