解决npm install时npm ERR! Unexpected end of JSON input while parsing near

最近我的npm发抽了似的,安装各种依赖出现各种报错,直接记录一下。

问题

执行npm install时,控制台的部分报错:

npm ERR! Unexpected end of JSON input while parsing near '...7839d064dd0d46cd1b88e'

npm ERR! A complete log of this run can be found in:
npm ERR!     E:DeveloperTool
odejs
ode_cache\_logs2021-01-04T08_02_35_882Z-debug.log

报错截图,如下:
解决npm install时npm ERR! Unexpected end of JSON input while parsing near

解决

  1. 清除缓存
npm cache clean --force

注意:清楚缓存可能需要一些时间,耐心等待~

  1. 重新安装
npm install

解决npm install时npm ERR! Unexpected end of JSON input while parsing near

  1. 试试npm run dev,服务器启动成功了!