Search code examples
symfonyuglifycss

Uglifycss error when I do assetic:dump


when I try to do the php app/console assetic:dump --env=prod on Symfony I get the following exception:

  [Assetic\Exception\FilterException]
  An error occurred while running:
  '/usr/bin/nodejs' '/usr/local/bin/uglifycss' '/tmp/assetic_uglifycssv74yv7'

  Error Output:

  /usr/local/lib/node_modules/uglifycss/uglifycss:29
  const { defaultOptions, processString, processFiles } = require('./')
        ^
  SyntaxError: Unexpected token {
      at Module._compile (module.js:439:25)
      at Object.Module._extensions..js (module.js:474:10)
      at Module.load (module.js:356:32)
      at Function.Module._load (module.js:312:12)
      at Function.Module.runMain (module.js:497:10)
      at startup (node.js:119:16)
      at node.js:906:3

I use uglify-js and uglifycss. When it does the js it does it well, but when it reaches the css it gives me the previous error. It only happens when I do the command on the --env=prod. I don't know what else to do.

Thanks!


Solution

  • I had a very old node version, upgrading to version 9 has fixed the bug.