解决 => Cannot find module ‘webpack-cli/bin/config-yargs
程序员文章站
2022-06-01 09:27:22
...
Error: Cannot find module ‘webpack-cli/bin/config-yargs’ =>
> internal/modules/cjs/loader.js:965
throw err;
^
Error: Cannot find module 'webpack-cli/bin/config-yargs'
Require stack:- H:\ld\task\code\Webpack\02\node_modules\webpack-dev-server\bin\webpack-dev-server.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:962:15)
at Function.Module._load (internal/modules/cjs/loader.js:838:27)
at Module.require (internal/modules/cjs/loader.js:1022:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (H:\ld\task\code\Webpack\02\node_modules\webpack-dev-server\bin\webpack-dev-server.js:65:1)
at Module._compile (internal/modules/cjs/loader.js:1118:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1138:10)
at Module.load (internal/modules/cjs/loader.js:982:32)
at Function.Module._load (internal/modules/cjs/loader.js:875:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'H:\\ld\\task\\code\\Webpack\\02\\node_modules\\webpack-dev-server\\bin\\webpack-dev-server.js'
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `webpack-dev-server --mode=development --config ./build/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start 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! C:\Users\6XD\AppData\Roaming\npm-cache\_logs\2020-11-17T13_49_48_053Z-debug.log
原因webpack版本的问题:
我的版本是
"webpack": "^5.4.0",
"webpack-cli": "^4.2.0",
"webpack-dev-server": "^3.11.0",
参考 =>
https://github.com/webpack/webpack-dev-server/issues/2759
"start": "webpack serve --mode development --config ./build/webpack.config.js",
上一篇: webpack打包报错:Cannot find module 'resolve-cwd'
下一篇: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js' 解决方案
推荐阅读
-
Linux系统中提示/usr/bin/ld: cannot find -lxxx错误的通用解决方法
-
Linux系统中提示/usr/bin/ld: cannot find -lxxx错误的通用解决方法
-
【已解决】运行webpack-dev-server时提示Error: Cannot find module ‘webpack-cli/bin/config-yargs‘
-
webpack5: Error: Cannot find module ‘webpack-cli/bin/config-yargs‘
-
Webpack 报错:Error: Cannot find module ‘webpack-cli/bin/config-yargs‘
-
webpack-dev-server 报错 Error: Cannot find module ‘webpack/bin/config-yargs‘
-
webpack——Error: Cannot find module ‘webpack-cli/bin/config-yargs‘
-
【webpack-dev-server】Error: Cannot find module ‘webpack-cli/bin/config-yargs‘
-
Error: Cannot find module 'webpack-cli/bin/config-yargs' at Function.Module._resolveFilename
-
【webpack】Error: Cannot find module webpack-cli/bin/config-yargs