npm run dev启动报以下错:
(1)解决报错Cannot find module 'webpack-cli/bin/config-yargs'
可能因为webpack与webpack-dev-server版本不兼容导致;可以通过以下命令进行卸载和重装(进入到项目目录下):
//卸载版本
cnpm uninstall webpack -g
cnpm uninstall -g webpack-dev-server
//安装指定版本
cnpm install webpack@3.8.0 --save-dev
cnpm install webpack-dev-server@2.9.7 --save-dev
版本在package.json下面有devDependencies,可以看到以上需要装的指定版本信息
"webpack": "^3.8.0",
"webpack-bundle-analyzer": "^2.9.0",
"webpack-dev-middleware": "^1.10.0",
"webpack-dev-server": "^2.9.7",
"webpack-hot-middleware": "^2.16.1",
"webpack-merge": "^4.1.0",
"yaml-loader": "^0.4.0"
(2)Error: Cannot find module 'extract-text-webpack-plugin'
缺少就通过 npm install extract-text-webpack-plugin 指令去安装