webpackのエラーが出て詰まった話(未解決)
auです。
npmで使用しているパッケージ以外削除したいなーと思ったので色々やったら進めなくなりました・・・。
環境
macOS Catalina 10.15.5
npm 6.14.5
概要
node_moduleを綺麗にしようと調べてコマンドを打っていたらwebpack4になってしまい、エラーから抜け出せなくなった。
npm prune npm find npm audit fix --force // 多分これが原因?
途中途中で動くか確認するのを怠ったのも原因ですが、脆弱性が確認されているパッケージの更新をしたせいな気もします。その更新にWebpackも含まれており、こうなったと考えています。
エラー文
npm run dev > project@1.0.0 dev /Users/username/project > webpack-dev-server --inline --progress --config build/webpack.dev.conf.js /Users/username/project/node_modules/copy-webpack-plugin/node_modules/schema-utils/dist/validate.js:96 throw new _ValidationError.default(errors, schema, configuration); ^ ValidationError: Invalid options object. Copy Plugin has been initialized using an options object that does not match the API schema. - options[0] misses the property 'patterns'. Should be: [non-empty string | object { from, to?, context?, globOptions?, toType?, force?, flatten?, transform?, cacheTransform?, transformPath?, noErrorOnMissing? }, ...] (should not have fewer than 1 item) at validate (/Users/username/project/node_modules/copy-webpack-plugin/node_modules/schema-utils/dist/validate.js:96:11) at new CopyPlugin (/Users/username/project/node_modules/copy-webpack-plugin/dist/index.js:24:30) at Object.<anonymous> (/Users/username/project/build/webpack.dev.conf.js:61:5) at Module._compile (internal/modules/cjs/loader.js:1133:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10) at Module.load (internal/modules/cjs/loader.js:977:32) at Function.Module._load (internal/modules/cjs/loader.js:877:14) at Module.require (internal/modules/cjs/loader.js:1019:19) at require (internal/modules/cjs/helpers.js:77:18) at WEBPACK_OPTIONS (/Users/username/project/node_modules/webpack-cli/bin/utils/convert-argv.js:114:13) at requireConfig (/Users/username/project/node_modules/webpack-cli/bin/utils/convert-argv.js:116:6) at /Users/username/project/node_modules/webpack-cli/bin/utils/convert-argv.js:123:17 at Array.forEach (<anonymous>) at module.exports (/Users/username/project/node_modules/webpack-cli/bin/utils/convert-argv.js:121:15) at Object.<anonymous> (/Users/username/project/node_modules/webpack-dev-server/bin/webpack-dev-server.js:84:40) at Module._compile (internal/modules/cjs/loader.js:1133:30) { errors: [ { keyword: 'required', dataPath: '[0]', schemaPath: '#/required', params: [Object], message: "should have required property 'patterns'", schema: [Object], parentSchema: [Object], data: [Object], children: [Array] } ], schema: { definitions: { ObjectPattern: [Object], StringPattern: [Object] }, type: 'object', additionalProperties: false, properties: { patterns: [Object], options: [Object] }, required: [ 'patterns' ] }, headerName: 'Copy Plugin', baseDataPath: 'options', postFormatter: null } npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! project@1.0.0 dev: `webpack-dev-server --inline --progress --config build/webpack.dev.conf.js` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the project@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/username/.npm/_logs/2020-06-17T14_14_51_767Z-debug.log
node_modulesを入れ直したりとやってみようと思います...