webpacker: Assets Precompile fails

I think I am missing something, I updated my gems and since then this is failing.

I also ran

rails webpacker:install
rails webpacker:install:vue

Here is my trace:

aks:formester$ RAILS_ENV=production rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Invoke yarn:install (first_time)
** Execute yarn:install
yarn install v0.21.3
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.55s.
** Execute assets:precompile
rake aborted!
ExecJS::RuntimeError: SyntaxError: Unexpected token: punc ())
/home/aks/playground/formester/app/assets/config/manifest.js:2
JS_Parse_Error.get ((execjs):3538:621)
(execjs):4060:47
(execjs):1:102
Object.<anonymous> ((execjs):1:120)
Module._compile (module.js:570:32)
Object.Module._extensions..js (module.js:579:10)
Module.load (module.js:487:32)
tryModuleLoad (module.js:446:12)
Function.Module._load (module.js:438:3)
Module.runMain (module.js:604:10)
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:39:in `exec'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:21:in `eval'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:46:in `call'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/uglifier-3.2.0/lib/uglifier.rb:195:in `run_uglifyjs'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/uglifier-3.2.0/lib/uglifier.rb:167:in `compile_with_map'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/uglifier_compressor.rb:52:in `call'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/uglifier_compressor.rb:30:in `call'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/processor_utils.rb:84:in `call_processor'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/processor_utils.rb:66:in `block in call_processors'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/processor_utils.rb:65:in `reverse_each'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/processor_utils.rb:65:in `call_processors'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/loader.rb:148:in `load_from_unloaded'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/loader.rb:59:in `block in load'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/loader.rb:324:in `fetch_asset_from_dependency_cache'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/loader.rb:43:in `load'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/cached_environment.rb:21:in `block in initialize'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/cached_environment.rb:48:in `load'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/directive_processor.rb:389:in `load'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/directive_processor.rb:358:in `block in link_paths'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/directive_processor.rb:368:in `block in resolve_paths'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/directive_processor.rb:364:in `each'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/directive_processor.rb:364:in `resolve_paths'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/directive_processor.rb:357:in `link_paths'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/directive_processor.rb:318:in `process_link_directory_directive'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/directive_processor.rb:181:in `block in process_directives'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/directive_processor.rb:179:in `each'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/directive_processor.rb:179:in `process_directives'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/directive_processor.rb:80:in `_call'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/directive_processor.rb:65:in `call'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/processor_utils.rb:84:in `call_processor'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/processor_utils.rb:66:in `block in call_processors'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/processor_utils.rb:65:in `reverse_each'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/processor_utils.rb:65:in `call_processors'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/loader.rb:148:in `load_from_unloaded'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/loader.rb:59:in `block in load'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/loader.rb:324:in `fetch_asset_from_dependency_cache'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/loader.rb:43:in `load'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/cached_environment.rb:21:in `block in initialize'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/cached_environment.rb:48:in `load'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/bundle.rb:24:in `block in call'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/utils.rb:166:in `dfs'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/bundle.rb:25:in `call'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/processor_utils.rb:84:in `call_processor'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/processor_utils.rb:66:in `block in call_processors'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/processor_utils.rb:65:in `reverse_each'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/processor_utils.rb:65:in `call_processors'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/loader.rb:148:in `load_from_unloaded'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/loader.rb:59:in `block in load'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/loader.rb:324:in `fetch_asset_from_dependency_cache'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/loader.rb:43:in `load'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/cached_environment.rb:21:in `block in initialize'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/cached_environment.rb:48:in `load'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/base.rb:67:in `find_asset'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/base.rb:74:in `find_all_linked_assets'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/manifest.rb:124:in `block in find'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/manifest.rb:123:in `each'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/manifest.rb:123:in `find'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/sprockets/manifest.rb:165:in `compile'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:68:in `block (3 levels) in define'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-4.0.0.beta4/lib/rake/sprocketstask.rb:148:in `with_logger'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:67:in `block (2 levels) in define'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `block in execute'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `each'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `execute'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:194:in `block in invoke_with_call_chain'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:187:in `invoke_with_call_chain'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/task.rb:180:in `invoke'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:152:in `invoke_task'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `block (2 levels) in top_level'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `each'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `block in top_level'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:117:in `run_with_threads'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:102:in `top_level'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:80:in `block in run'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:178:in `standard_exception_handling'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.0.0/lib/rake/application.rb:77:in `run'
/home/aks/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
/home/aks/.rbenv/versions/2.3.1/bin/rake:23:in `load'
/home/aks/.rbenv/versions/2.3.1/bin/rake:23:in `<main>'
Tasks: TOP => assets:precompile

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 3
  • Comments: 30 (23 by maintainers)

Most upvoted comments

I’m using option 1 as suggested by @RavenXce, but I also had to install and use babel-polyfill

That error occurs because uglifier-js doesn’t support shorthand method syntax, i.e. myMethod() { .. }, (or ES6 in general).

You need to lock uglifier in package.json to "uglify-js": "git://github.com/mishoo/UglifyJS2#harmony", if you want to use that syntax.

See: https://github.com/lautis/uglifier#uglifier and https://github.com/mishoo/UglifyJS2/issues/448 for more details

Edit: It seems from that issue thread that the community is moving towards babel minify (babili). We can perhaps consider that as the default compressor instead.