Vue日常报错
报错信息:
Error: Cannot find module 'webpack/bin/config-yargs' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15) at Function.Module._load (internal/modules/cjs/loader.js:506:25) at Module.require (internal/modules/cjs/loader.js:636:17) at require (internal/modules/cjs/helpers.js:20:18) at Object.<anonymous> (E:\MIKEY\WebStromWorkSpace\TestWebpackVue\node_modules\webpack-dev-server\bin\webpack-dev-server.js:54:1) 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) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! TestWebpackVue@1.0.0 dev: `webpack-dev-server --open --port 3000 --contentBase src --hot` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the TestWebpackVue@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! E:\MIKEY\NodeJs\node_cache\_logs\2018-11-21T14_46_04_994Z-debug.log E:\MIKEY\WebStromWorkSpace\TestWebpackVue>npm i webpack@3.8.1 -D > uglifyjs-webpack-plugin@0.4.6 postinstall E:\MIKEY\WebStromWorkSpace\TestWebpackVue\node_modules\uglifyjs-webpack-plugin > node lib/post_install.js npm WARN css-loader@1.0.1 requires a peer of webpack@^4.0.0 but none is installed. You must install peer dependencies yourself. npm WARN less-loader@4.1.0 requires a peer of less@^2.3.1 || ^3.0.0 but none is installed. You must install peer dependencies yourself. npm WARN webpack-cli@3.1.2 requires a peer of webpack@^4.x.x but none is installed. You must install peer dependencies yourself. npm WARN TestWebpackVue@1.0.0 No description npm WARN TestWebpackVue@1.0.0 No repository field. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
报错截图:
解决方法:webpack和webpack-dev-server版本兼容问题,更改版本即可!
合群是堕落的开始 优秀的开始是孤行