如何修复 WebPack 错误 describe: optionsSchema.definitions.output.properties.path.description
问题:
你正在尝试构建你的 webpack 项目,但你看到类似这样的错误消息:
webpack_error.txt
/home/uli/project/node_modules/webpack-cli/bin/config-yargs.js:89
describe: optionsSchema.definitions.output.properties.path.description,
^
TypeError: Cannot read property 'properties' of undefined
at module.exports (/home/uli/project/node_modules/webpack-cli/bin/config-yargs.js:89:48)
at /home/uli/project/node_modules/webpack-cli/bin/webpack.js:60:27
at Object.<anonymous> (/home/uli/project/node_modules/webpack-cli/bin/webpack.js:515:3)
at Module._compile (internal/modules/cjs/loader.js:723:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:734:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)
at Module.require (internal/modules/cjs/loader.js:659:17)
at require (internal/modules/cjs/helpers.js:22:18)解决方案
这是 webpack 4.20.0 中的已知 bug - 你可以通过使用 webpack 4.19.0 来规避此问题。
查找类似这样的行
package.json.patch
"webpack": "^4.7.0",在你的 package.json 中。插入符号(^)允许 npm 使用任何 4.x.x 版本 - 包括有问题的 4.20.0。
将上述行替换为
package.json.fixed
"webpack": "4.19.0",以仅使用 webpack 4.19.0。
之后,运行 npm install 并重试构建你的应用程序。
Check out similar posts by category:
Javascript, NodeJS
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow