一些常见的npm报错的解决方法

6,479 阅读1分钟

一些常见的npm报错的解决方法

1. npm WARN Local package.json exists, but node_modules missing, did you mean to install?

error

解决方法:

输入npm install 或 cnpm install 后,再次启动

npm run dev 成功启动

2. npm 报错 This is probably not a problem with npm. There is likely additional logging output above.

在这里插入图片描述

有时候npm报错只会有这一行提示,那么这个时候有很大的可能就是安装包导致的报错,那么我们只需要重新安装一下包再启动就行了。

  • 重新 npm install

  • 再 npm run dev

如果重新安装一次包还是不行,会有报错的话,那就把之前安装的包都删掉,清除缓存,重新安装。

  • rm -rf node_modules 或者 del node_modules
  • rm package-lock.json
  • npm cache clear --force
  • npm install
  • npm run dev