Friday, April 13, 2018

ExecJS::RuntimeError: SyntaxError: Unexpected token punc «(», expected punc «:»

I got this error when deploy Rails app to production server.
This error will be raised if your javasctripts on assets include ES6 syntax.

These steps will fix the probrem.

  1. Update uglifier
    bundle update uglifier
  2. Modify config/environments/production.rb
    config.assets.js_compressor = :uglifier
    config.assets.js_compressor = true)