报错内容:
$ npm run build
> nuistoj@0.1.0 build D:\_DATA_\webStormProject\nuistoj
> node scripts/build.js
D:\_DATA_\webStormProject\nuistoj\node_modules\schema-utils\src\validateOptions.js:32
throw new ValidationError(ajv.errors, name);
^
ValidationError: Compression Plugin Invalid Options
options should NOT have additional properties
at validateOptions (D:\_DATA_\webStormProject\nuistoj\node_modules\schema-utils\src\validateOptions.js:32:11)
at new CompressionPlugin (D:\_DATA_\webStormProject\nuistoj\node_modules\compression-webpack-plugin\dist\index.js:55:31)
at module.exports (D:\_DATA_\webStormProject\nuistoj\config\webpack.config.js:478:7)
at Object.<anonymous> (D:\_DATA_\webStormProject\nuistoj\scripts\build.js:52:16)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:741:12)
at startup (internal/bootstrap/node.js:285:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! nuistoj@0.1.0 build: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nuistoj@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
解决办法:
将package.json中的"compression-webpack-plugin": "^2.0.0",
版本降至 "compression-webpack-plugin": "^1.1.11",
重新安装"compression-webpack-plugin"
之后在npm run build
即可。