运行rake assets:precompile
时出现异常错误。我使用的是jruby 1.6.5.1,问题只发生在一台机器上,但在其他机器上运行正常。
[x@x someapp]$ rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/home/x/.rvm/rubies/jruby-1.6.5.1/bin/jruby /home/x/.rvm/gems/jruby-1.6.5.1/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!
partial character in source, but hit end near �\")&& (k=/^[\\s\\xA0]+/,l=/[\\s\\xA0]+$/),h=e(c),c.addEventListener......
..............................
(in /home/x/someapp/cmeng/app/assets/javascripts/application.js)
json/ext/Parser.java:249:in `parse'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/json-1.6.1-java/lib/json/common.rb:148:in `parse'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/multi_json-1.0.3/lib/multi_json/engines/json_gem.rb:13:in `decode'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/multi_json-1.0.3/lib/multi_json.rb:65:in `decode'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/execjs-1.2.9/lib/execjs/external_runtime.rb:61:in `extract_result'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/execjs-1.2.9/lib/execjs/external_runtime.rb:27:in `exec'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/execjs-1.2.9/lib/execjs/external_runtime.rb:40:in `compile_to_tempfile'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/execjs-1.2.9/lib/execjs/external_runtime.rb:26:in `exec'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/uglifier-1.0.4/lib/uglifier.rb:95:in `compile'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/actionpack-3.1.1/lib/sprockets/compressors.rb:18:in `compress'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/sprockets-2.0.3/lib/sprockets/processing.rb:265:in `js_compressor='
org/jruby/RubyProc.java:270:in `call'
org/jruby/RubyProc.java:220:in `call'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/sprockets-2.0.3/lib/sprockets/processor.rb:29:in `evaluate'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/tilt-1.3.3/lib/tilt/template.rb:76:in `render'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/sprockets-2.0.3/lib/sprockets/context.rb:175:in `evaluate'
org/jruby/RubyArray.java:1612:in `each'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/sprockets-2.0.3/lib/sprockets/context.rb:172:in `evaluate'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/sprockets-2.0.3/lib/sprockets/bundled_asset.rb:242:in `build_source'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/sprockets-2.0.3/lib/sprockets/caching.rb:30:in `cache_hash'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/sprockets-2.0.3/lib/sprockets/bundled_asset.rb:235:in `build_source'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/sprockets-2.0.3/lib/sprockets/bundled_asset.rb:71:in `digest'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/sprockets-2.0.3/lib/sprockets/asset.rb:95:in `digest_path'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/actionpack-3.1.1/lib/sprockets/static_compiler.rb:58:in `path_for'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/actionpack- 3.1.1/lib/sprockets/static_compiler.rb:35:in `write_asset'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/actionpack-3.1.1/lib/sprockets/static_compiler.rb:21:in `compile'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/sprockets-2.0.3/lib/sprockets/base.rb:151:in `each_logical_path'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/sprockets-2.0.3/lib/sprockets/base.rb:139:in `each_file'
org/jruby/RubyArray.java:1612:in `each'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/sprockets-2.0.3/lib/sprockets/base.rb:129:in `each_entry'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/sprockets-2.0.3/lib/sprockets/base.rb:137:in `each_file'
org/jruby/RubyArray.java:1612:in `each'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/sprockets-2.0.3/lib/sprockets/base.rb:136:in `each_file'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/sprockets-2.0.3/lib/sprockets/base.rb:149:in `each_logical_path'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/actionpack-3.1.1/lib/sprockets/static_compiler.rb:18:in `compile'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/actionpack-3.1.1/lib/sprockets/assets.rake:52:in `internal_precompile'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/actionpack-3.1.1/lib/sprockets/assets.rake:66:in `(root)'
org/jruby/RubyProc.java:270:in `call'
org/jruby/RubyProc.java:220:in `call'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `execute'
org/jruby/RubyArray.java:1612:in `each'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `invoke_with_call_chain'
/home/x/.rvm/rubies/jruby-1.6.5.1/lib/ruby/1.8/monitor.rb:191:in `mon_synchronize'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/actionpack-3.1.1/lib/sprockets/assets.rake:56:in `(root)'
org/jruby/RubyProc.java:270:in `call'
org/jruby/RubyProc.java:220:in `call'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `execute'
org/jruby/RubyArray.java:1612:in `each'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `invoke_with_call_chain'
/home/x/.rvm/rubies/jruby-1.6.5.1/lib/ruby/1.8/monitor.rb:191:in `mon_synchronize'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
org/jruby/RubyArray.java:1612:in `each'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `run'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/home/x/.rvm/gems/jruby-1.6.5.1/gems/rake-0.9.2.2/bin/rake:33:in `(root)'
org/jruby/RubyKernel.java:1063:in `load'
/home/x/.rvm/gems/jruby-1.6.5.1/bin/rake:19:in `(root)'
如果我在app/assets/javascripts/application.js
中删除了jQuery require(jquery和jquery_ujs),则预编译任务会成功。
我已将错误跟踪到jquery源文件:
// IE doesn't match non-breaking spaces with \s
if ( rnotwhite.test( "\xA0" ) ) {
trimLeft = /^[\s\xA0]+/;
trimRight = /[\s\xA0]+$/;
}
\ xA0字符是否会导致此错误?还是别的什么?
感谢。
答案 0 :(得分:1)
通过从:uglifier
压缩器(默认)切换到:closure
编译器,我能够在jRuby 1.6.7下使用jQuery 1.7.2进行资产预编译。 (我也尝试了:yui
编译器,但它显然与jRuby不兼容 - 它想使用jRuby不想提供的fork
。)