webpack报错

webpack-dev-server --inline --progress --config build/webpack.dev.conf.js

internal/modules/cjs/loader.js:783
throw err;
^

Error: Cannot find module 'webpack/bin/config-yargs'
Require stack:
- E:\learnVuejs\Mall\mall\node_modules\webpack-dev-server\bin\webpack-dev-server.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:780:15)
at Function.Module._load (internal/modules/cjs/loader.js:685:27)
at Module.require (internal/modules/cjs/loader.js:838:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (E:\learnVuejs\Mall\mall\node_modules\webpack-dev-server\bin\webpack-dev-server.js:54:1)
at Module._compile (internal/modules/cjs/loader.js:945:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:962:10)
at Module.load (internal/modules/cjs/loader.js:798:32)
at Function.Module._load (internal/modules/cjs/loader.js:711:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:1014:10) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'E:\\learnVuejs\\Mall\\mall\\node_modules\\webpack-dev-server\\bin\\webpack-dev-server.js'
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mall@1.0.1 dev: `webpack-dev-server --inline --progress --config build/webpack.dev.conf.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mall@1.0.1 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! C:\Users\baixinL\AppData\Roaming\npm-cache\_logs\2019-11-25T12_59_00_029Z-debug.log

 

    "webpack": "^4.41.2",
    "webpack-bundle-analyzer": "^3.6.0",
    "webpack-dev-server": "^2.9.1",
    "webpack-merge": "^4.1.0"

 经检查,是webpack的版本不是  extract-text-webpack-plugin@3.0.2、html-webpack-plugin@2.30.1、less-loader@5.0.0的依赖的版本

warning " > extract-text-webpack-plugin@3.0.2" has incorrect peer dependency "webpack@^3.1.0".
warning " > html-webpack-plugin@2.30.1" has incorrect peer dependency "webpack@1 || ^2 || ^2.1.0-beta || ^2.2.0-rc || ^3".
warning " > less-loader@5.0.0" has unmet peer dependency "less@^2.3.1 || ^3.0.0".

解决:安装正确的依赖(webpack@3.6.0的版本是符合,也许还有其它符合的版本)  yarn add -D webpack@3.6.0

 

posted @ 2019-11-25 21:14  baixinL  阅读(1986)  评论(0编辑  收藏  举报