documentcloud / jammit

Industrial Strength Asset Packaging for Rails
http://documentcloud.github.io/jammit/
MIT License
1.16k stars 197 forks source link

uglifier and closure compiler fails on Rails 3.1 #178

Closed masterkain closed 13 years ago

masterkain commented 13 years ago
# Closure compiler
/Users/kain/.rvm/gems/ruby-1.9.2-p180/gems/closure-compiler-1.1.1/lib/closure/compiler.rb:28:in `write': Broken pipe (Errno::EPIPE)
    from /Users/kain/.rvm/gems/ruby-1.9.2-p180/gems/closure-compiler-1.1.1/lib/closure/compiler.rb:28:in `block in compile'
    from /Users/kain/.rvm/gems/ruby-1.9.2-p180/gems/closure-compiler-1.1.1/lib/closure/popen.rb:56:in `popen'
    from /Users/kain/.rvm/gems/ruby-1.9.2-p180/gems/closure-compiler-1.1.1/lib/closure/compiler.rb:22:in `compile'
    from /Users/kain/.rvm/gems/ruby-1.9.2-p180/bundler/gems/jammit-80ec16f8c332/lib/jammit/compressor.rb:74:in `compress_js'
    from /Users/kain/.rvm/gems/ruby-1.9.2-p180/bundler/gems/jammit-80ec16f8c332/lib/jammit/packager.rb:83:in `pack_javascripts'
    from /Users/kain/.rvm/gems/ruby-1.9.2-p180/bundler/gems/jammit-80ec16f8c332/lib/jammit/packager.rb:41:in `block in precache_all'
    from /Users/kain/.rvm/gems/ruby-1.9.2-p180/bundler/gems/jammit-80ec16f8c332/lib/jammit/packager.rb:41:in `each'
    from /Users/kain/.rvm/gems/ruby-1.9.2-p180/bundler/gems/jammit-80ec16f8c332/lib/jammit/packager.rb:41:in `precache_all'
    from /Users/kain/.rvm/gems/ruby-1.9.2-p180/bundler/gems/jammit-80ec16f8c332/lib/jammit.rb:134:in `package!'
    from /Users/kain/.rvm/gems/ruby-1.9.2-p180/bundler/gems/jammit-80ec16f8c332/lib/jammit/command_line.rb:29:in `initialize'
    from /Users/kain/.rvm/gems/ruby-1.9.2-p180/bundler/gems/jammit-80ec16f8c332/bin/jammit:5:in `new'
    from /Users/kain/.rvm/gems/ruby-1.9.2-p180/bundler/gems/jammit-80ec16f8c332/bin/jammit:5:in `<top (required)>'
    from /Users/kain/.rvm/gems/ruby-1.9.2-p180/bin/jammit:21:in `load'
    from /Users/kain/.rvm/gems/ruby-1.9.2-p180/bin/jammit:21:in `<main>'

# Ugilifier
/Users/kain/.rvm/gems/ruby-1.9.2-p180/gems/multi_json-1.0.3/lib/multi_json/engines/yajl.rb:7:in `<class:Yajl>': uninitialized constant Yajl::ParseError (NameError)
    from /Users/kain/.rvm/gems/ruby-1.9.2-p180/gems/multi_json-1.0.3/lib/multi_json/engines/yajl.rb:6:in `<module:Engines>'
    from /Users/kain/.rvm/gems/ruby-1.9.2-p180/gems/multi_json-1.0.3/lib/multi_json/engines/yajl.rb:4:in `<module:MultiJson>'
    from /Users/kain/.rvm/gems/ruby-1.9.2-p180/gems/multi_json-1.0.3/lib/multi_json/engines/yajl.rb:3:in `<top (required)>'
    from /Users/kain/.rvm/gems/ruby-1.9.2-p180/gems/multi_json-1.0.3/lib/multi_json.rb:50:in `require'
    from /Users/kain/.rvm/gems/ruby-1.9.2-p180/gems/multi_json-1.0.3/lib/multi_json.rb:50:in `engine='
    from /Users/kain/.rvm/gems/ruby-1.9.2-p180/gems/multi_json-1.0.3/lib/multi_json.rb:10:in `engine'
    from /Users/kain/.rvm/gems/ruby-1.9.2-p180/gems/multi_json-1.0.3/lib/multi_json.rb:72:in `encode'
    from /Users/kain/.rvm/gems/ruby-1.9.2-p180/gems/uglifier-0.5.4/lib/uglifier.rb:43:in `compile'
    from /Users/kain/.rvm/gems/ruby-1.9.2-p180/bundler/gems/jammit-80ec16f8c332/lib/jammit/compressor.rb:74:in `compress_js'
    from /Users/kain/.rvm/gems/ruby-1.9.2-p180/bundler/gems/jammit-80ec16f8c332/lib/jammit/packager.rb:83:in `pack_javascripts'
    from /Users/kain/.rvm/gems/ruby-1.9.2-p180/bundler/gems/jammit-80ec16f8c332/lib/jammit/packager.rb:41:in `block in precache_all'
    from /Users/kain/.rvm/gems/ruby-1.9.2-p180/bundler/gems/jammit-80ec16f8c332/lib/jammit/packager.rb:41:in `each'
    from /Users/kain/.rvm/gems/ruby-1.9.2-p180/bundler/gems/jammit-80ec16f8c332/lib/jammit/packager.rb:41:in `precache_all'
    from /Users/kain/.rvm/gems/ruby-1.9.2-p180/bundler/gems/jammit-80ec16f8c332/lib/jammit.rb:134:in `package!'
    from /Users/kain/.rvm/gems/ruby-1.9.2-p180/bundler/gems/jammit-80ec16f8c332/lib/jammit/command_line.rb:29:in `initialize'
    from /Users/kain/.rvm/gems/ruby-1.9.2-p180/bundler/gems/jammit-80ec16f8c332/bin/jammit:5:in `new'
    from /Users/kain/.rvm/gems/ruby-1.9.2-p180/bundler/gems/jammit-80ec16f8c332/bin/jammit:5:in `<top (required)>'
    from /Users/kain/.rvm/gems/ruby-1.9.2-p180/bin/jammit:21:in `load'
    from /Users/kain/.rvm/gems/ruby-1.9.2-p180/bin/jammit:21:in `<main>'
jashkenas commented 13 years ago

A broken pipe inside of the Closure Compiler often means that your JavaScript has a syntax error.

agibralter commented 13 years ago

I'd watch out for JS keywords like char and float being used as variable names and object keys -- that always gets me. e.g. $("#foo").css({float: "left"}) will often cause JS minifiers like YUI to fail.

masterkain commented 13 years ago

I was suspecting that jammit wasn't the culprit here.

However we are upgrading our app to rails 3.1 and the same js/css gets minified well in rails 2.3 + jammit.

I'll take a second look, too bad the stack trace does not indicate what's failing; maybe this version of the closure gem got more strict.