解决npm run dev报错'webpack-dev-server' 不是内部命令或外部命令npm WARN Local package.json exists,but....

报错图像

在这里插入图片描述
报错原因就是你没有安装一些依赖

解决方法一

第一步

npm install --registry=https://registry.npm.taobao.org

安装的时候 最好把淘宝镜像搞进去快些registry=https://registry.npm.taobao.org

这部时还可能报错:请看解决方法二

第二步

npm run build 

第三步

npm run dev

在这里插入图片描述
成功解决

解决方法二

npm install 时报错

D:\vue-playlist>npm install

> uglifyjs-webpack-plugin@0.4.6 postinstall D:\vue-playlist\node_modules\webpack\node_modules\uglifyjs-webpack-plugin
> node lib/post_install.js

npm WARN ajv-keywords@3.2.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN The package vue-router is included as both a dev and production dependency.
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"})

added 865 packages from 478 contributors, updated 28 packages and audited 10653 packages in 160.56s
found 2 vulnerabilities (1 moderate, 1 high)
 run `npm audit fix` to fix them, or `npm audit` for details

执行下面命令

npm audit fix --force

成功解决

发布了159 篇原创文章 · 获赞 36 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/weixin_43342105/article/details/105527157