解決npm ERR!Unexpected end of JSON input while paring near (解析附近時JSON輸入意外結束)'...."^2.0.0-rc.0","glob"'

摘要javascript

  最近更新了一次node,可是更新後npm的命令老是會報java

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_modules\har-validator\node_modules\ajv):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Unexpected end of JSON input while parsing near '...:"^2.0.0-rc.0","glob"'node

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

的錯誤信息,致使沒法進行正常的npm install。通過半天的錯誤信息搜索,找到了較爲友好的解決辦法。github

解決辦法npm

方法一:清除npm緩存json

  具體命令步驟:緩存

npm cache clean --force //清除npm緩存
npm install @(Library you need) //下載安裝你須要的庫

方法二:刪除合併文件學習

  具體命令步驟:fetch

刪除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意外結束的方法,你們若是有更好的辦法能夠評論出來,一塊兒學習。。。

相關文章
相關標籤/搜索