Node.js 语法错误:意外的保留字=>;prettier/third-party.js
我对Node、npm和webpack都很陌生。我正试图建立一个与顺风css 一切都很好,但是当我运行Node.js 语法错误:意外的保留字=>;prettier/third-party.js,node.js,npm,webpack,gulp,prettier,Node.js,Npm,Webpack,Gulp,Prettier,我对Node、npm和webpack都很陌生。我正试图建立一个与顺风css 一切都很好,但是当我运行npm-run-dev时,我得到以下错误: > 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.conf
npm-run-dev
时,我得到以下错误:
> 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
>CMS-tailwind@1.0.0dev/Users//sites/***/www
>吞咽式开发
/Users/***/sites/***/www/node_modules/prettier/third-party.js:9871
用于等待(this.config.searchPlaces的const-place){
^^^^^
SyntaxError:意外的保留字
在createScript上(vm.js:80:10)
在Object.runInThisContext(vm.js:139:10)
在模块处编译(Module.js:616:28)
在Object.Module.\u extensions..js(Module.js:663:10)
在Module.load(Module.js:565:32)
在tryModuleLoad时(module.js:505:12)
在Function.Module.\u加载(Module.js:497:3)
at Module.require(Module.js:596:17)
根据需要(内部/module.js:11:18)
在对象上。(/Users/***/sites/***/www/node_modules/prettier/index.js:16551:18)
npm错误!代码错误周期
npm错误!错误1
npm ERR!CMS-tailwind@1.0.0德夫:`吞咽德夫`
npm错误!退出状态1
npm错误!
npm ERR!在CMS上失败-tailwind@1.0.0开发脚本。
npm错误!这可能不是npm的问题。上面可能还有其他日志输出。
npm ERR!此运行的完整日志可在以下位置找到:
npm ERR!/Users/***/.npm/_logs/2020-08-28T14_23_16_034Z-debug.log
为什么会出现这种情况?我如何确保我能在未来解决这个问题?如下所述:
此语法:
wait的(this.config.searchPlaces的const-place){
// ...
}
在10.0.0版开始的NodeJS中可用。我在NodeV8.11.2中遇到了相同的问题。将node升级到12.3.1版,效果良好
npm i -D prettier@1.13.7
更多信息:我知道已经很晚了,但是对于来到这里的人,您可以使用node v10或将prettier降级到v1.x.x 如果有任何包抛出类似这样的意外错误,请在github上或从node_模块检查它的package.json,并查找引擎
"engines": {
"node": ">=8"
},
确保它与您的节点匹配,如果可能,请更改(升级)节点版本或使用不同的(较旧的)版本软件包版本。您可以通过更改此文件下拉列表中的版本来检查哪个软件包版本合适。您是否编写了任何代码?我更新/添加/删除了一些Craft插件。但尚未编写或接触任何类型的css/js。您是否将Craft 3软件包导入到您的代码中?您的node版本是什么?@KiJéy我正在运行node在v8.11.3中