zoukankan      html  css  js  c++  java
  • 解决npm ERR!Unexpected end of JSON input while paring near (解析附近时JSON输入意外结束)'...."^2.0.0-rc.0","glob"'等npm install错误

    摘要

      最近更新了一次node,但是更新后npm的命令总是会报

    npm WARN deprecated fsevents@2.0.6: Please update: there are crash fixes
    npm WARN deprecated text-encoding@0.7.0: no longer maintained
    npm WARN deprecated fsevents@1.2.9: One of your dependencies needs to upgrade to fsevents v2: 1) Proper nodejs v10+ support 2) No more fetching binaries from AWS, smaller package size
    npm WARN deprecated core-js@2.3.0: core-js@<3.0 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
    npm WARN deprecated core-js@1.2.7: core-js@<2.6.8 is no longer maintained. Please, upgrade to core-js@3 or at least to actual version of core-js@2.
    npm WARN deprecated left-pad@1.3.0: use String.prototype.padStart()
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: ajv@^6.5.5 (node_moduleshar-validator ode_modulesajv):
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Unexpected end of JSON input while parsing near '...:"^2.0.0-rc.0","glob"'

    npm ERR! Unexpected end of JSON input while parsing near '...:"^2.0.0-rc.0","glob"'

    的错误信息,导致无法进行正常的npm install。经过半天的错误信息搜索,找到了较为友好的解决办法。

    解决办法

    方法一:清除npm缓存

      具体命令步骤:

    npm cache clean --force //清除npm缓存
    npm install @(Library you need) //下载安装你需要的库

    方法二:删除合并文件

      具体命令步骤:

    删除package.lock.json合并文件
    npm install @(Library you need) //下载安装你需要的库

    方法三:配置默认注册表

      具体命令步骤:  

    注册表配置修改为默认值:
    npm config set registry https://registry.npmjs.org/

    参考地址:https://github.com/npm/npm/issues/19072

    总结

      分享一下解决npm的JSON意外结束的方法,大家如果有更好的办法可以评论出来,一起学习。。。

  • 相关阅读:
    mongodb3.6 query plan机制变更导致慢查询问题排查
    zoj 3822 概率期望dp入门
    poj 4513 吉哥系列故事――完美队形II 最长回文子串
    poj 3974 Palindrome O(n)回文子串(Manacher)算法
    hdu 4405 Aeroplane chess 概率dp入门题
    hdu 5001 walk 概率dp入门题
    hdu 3586 Information Disturbing 树形dp+二分
    hdu 2296 Ring AC自动机+DP
    poj 3691 DNA repair AC自动机+DP
    hdu 1520 Anniversary party 树形dp水题
  • 原文地址:https://www.cnblogs.com/BlueBerryCode/p/11935570.html
Copyright © 2011-2022 走看看