升级serverless时未能安装成功怎么办

本篇内容主要讲解“升级serverless时未能安装成功怎么办”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“升级serverless时未能安装成功怎么办”吧!

在升级 serverless 时,未能安装成功,提示问题如下

$ npm i -g serverless
npm ERR! Unexpected end of JSON input while parsing near '...oyNMOOPIvOSSv8aveUYxO'

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-07-17T09_32_21_882Z-debug.log
     

捉虫

既然是 npm 的问题,那首先去 github 的源码中找找问题

npm 的源码在 https://github.com/npm/cli,找到以下 Issue

  • Unexpected end of JSON input while parsing near #21172
        [1]

 

解决方案

这是因为本地 npm cache 的问题,清除掉本地的 cache 即可成功,如下所示

$ npm cache clean --force
npm WARN using --force I sure hope you know what you are doing.

$ npm i -g serverless

 

另外可以通过 npm cache verify 去查看缓存位置

$ npm cache verify
Cache verified and compressed (~/.npm/_cacache):
Content verified: 4217 (168362093 bytes)
Index entries: 5814
Finished in 11.194s

到此,相信大家对“升级serverless时未能安装成功怎么办”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

原创文章,作者:carmelaweatherly,如若转载,请注明出处:https://blog.ytso.com/219889.html

(0)
上一篇 2022年1月2日
下一篇 2022年1月2日

相关推荐

发表回复

登录后才能评论