npm run dev遇到报错

Posted zpp1234

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了npm run dev遇到报错相关的知识,希望对你有一定的参考价值。

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 指令去安装


以上是关于npm run dev遇到报错的主要内容,如果未能解决你的问题,请参考以下文章

npm run dev 报错:missing script:dev

npm run dev 报错:missing script:dev

vue项目,npm install后,npm run dev报错问题

npm run dev报错

npm run dev 报错:missing script:dev

npm dev run 报错