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:
> [email protected] 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! [email protected] dev: `gulp dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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?
I faced same issue first I tried with upgrading node v8 --> node v10 works fine.
If you do not want to upgrade your node version you can downgrade prettier version to [email protected] This fix is also working properly.
Downgrade prettier version:
npm i -D [email protected]
More info: https://devsnooper.com/syntaxerror-unexpected-reserved-word/
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With