npm run dev
fortune@1.0.0 dev D:\work\uni\fs\fengshui_vue
webpack-dev-server --inline --progress --config build/webpack.dev.conf.js
‘webpack-dev-server’ 不是内部或外部命令,也不是可运行的程序
或批处理文件。
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! fortune@1.0.0 dev: webpack-dev-server --inline --progress --config build/webpack.dev.conf.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the fortune@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! C:\Users\Administrator\AppData\Roaming\npm-cache_logs\2021-04-27T05_40_41_162Z-debug.log
原因:新版的webpack-dev-server 3.1.14 存在问题。
解决方法:package.json 中指定 webpack-dev-server 低版本号
方法1:
“webpack-dev-server”: “^2.9.1”
删除 node_modules 目录,再重新安装依赖包
npm install -S // 这种方式安装的时间会长些,也可以只重装 webpack-dev-server模块
**方法2:**单独重装 webpack-dev-server模块
(1)npm uninstall webpack-dev-server
(2)npm install webpack-dev-server@2.9.1
(3)npm run dev
**方法3:**单独重装 webpack-dev-server模块
删除node_modules ,重新npm install 然后 npm run dev
参考:https://blog.csdn.net/weixin_45247365/article/details/103725882