Search code examples
node.jsnpmwebpackgulpprettier

SyntaxError: Unexpected reserved word => prettier/third-party.js


I'm pretty new to Node, npm and webpack. I'm trying to set up a Craft 3 environment with Tailwind css.

Everything worked fine out of the box, but when i run npm run dev i get the following error:

> craftcms-tailwind@1.0.0 dev /Users//sites/***/www
> gulp dev

/Users/***/sites/***/www/node_modules/prettier/third-party.js:9871
      for await (const place of this.config.searchPlaces) {
          ^^^^^

SyntaxError: Unexpected reserved word
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/***/sites/***/www/node_modules/prettier/index.js:16551:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! craftcms-tailwind@1.0.0 dev: `gulp dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the craftcms-tailwind@1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/***/.npm/_logs/2020-08-28T14_23_16_034Z-debug.log

Why is this hapening and how can i make sure i can fix this in the furure?


Solution

  • As described here : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of

    This syntax :

    for await (const place of this.config.searchPlaces) {
      // ...
    }
    

    is available in NodeJS starting version 10.0.0