npm install报错: Unexpected end of JSON input while parsing near

运行项目的时候,npm install总遇见Unexpected end of JSON input while parsing near报错

网上容易搜到的一些方法无效

//1.清理cache,无效
npm cache clean --force

//2.换镜像,无效
npm config set registry "https://registry.npm.taobao.org" //淘宝
npm config set registry "http://registry.npmjs.org"       //原景象

 然后看到https://blog.csdn.net/weixin_41902031/article/details/80041000里说是因为npm和node版本不匹配,把npm版本降到v4,真的不报错了

$ npm -g i npm@4

可喜可贺,特此记录

你可能感兴趣的:(前端工具)