admin 百科大全 2023-04-03 12:00:52 亲测解决npm ERR! Unexpected end of JSON input while parsing near...的方法_zsl888822的博客-CSDN博客 亲测解决npm ERR! Unexpected end of JSON input while parsing near...的方法_zsl888822的博客-CSDN博客 创始元灵6666 今天在创建项目的时候,发现一直创建不成功,安装项目依赖的时候报错:npm ERR! Unexpected end of JSON input while parsing near… 具体报错详情: 经过自己亲测发现如下解决方法: 方案一(亲测已解决): 清除缓存 npm cache clean --force npm install 方案二(亲测): 第一次按照上面的方法 npm cache clean --force 轻松就解决问题了,但是今天我用的时候发现依然报错: npm ERR! Unexpected end of JSON input while parsing near... ...... npm ERR! A complete log of this run can be found in: ...... 于是我就按着上次的方法发现不行,还是报错,我就又连着试了好几次还是不行 后来查阅各种方案,发现只需要把镜像改一下就行了,具体看下面 第一步还是:npm cache clean --force npm cache clean --force 第二步:切换为淘宝镜像 npm config set registry https://registry.npm.taobao.org/ npm config get registry https://registry.npm.taobao.org/ 验证时候切换淘宝镜像成功,命令行输入: npm config list 3.第三步: npm install 注意:下面走捷径啦!!!! 直接输入:npm install --global cnpm 然后使用:cnpm install 执行上面命令后,发现问题解决!!! 最简单解决就是输入 npm install --global cnpm 然后使用 cnpm install 装包 原因分析:npm官方服务器在国外,网络受阻性大、而淘宝的cnpm在国内,所以用淘宝的快就ok了 本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。 npm JSON err DABAN RP主题是一个优秀的主题,极致后台体验,无插件,集成会员系统白度搜_经验知识百科全书 » 亲测解决npm ERR! Unexpected end of JSON input while parsing near...的方法_zsl888822的博客-CSDN博客
0条评论