[英]npm ERR! Unexpected end of JSON input while parsing near '...tore-4.0.0.tgz","file'
I was facing this problem in windows 7 and now on Ubuntu 19.10.我在 windows 7 和现在 Ubuntu 19.10 遇到了这个问题。 I just finished formatting my PC and setup the development environment.
我刚刚完成 PC 的格式化并设置了开发环境。 Anyone can help?
任何人都可以帮忙吗?
node v12.16.2节点 v12.16.2
npm v6.14.4 npm v6.14.4
npm install -g gatsby-cli
npm WARN deprecated core-js@2.6.11: core-js@<3 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 ERR! Unexpected end of JSON input while parsing near '...tore-4.0.0.tgz","file'
npm ERR! A complete log of this run can be found in:
npm ERR! /home/rodrigo/.npm/_logs/2020-04-14T03_11_30_986Z-debug.log
When a retry to run npm install -g gatsby-cli
, this is what happens:当重试运行
npm install -g gatsby-cli
时,会发生以下情况:
npm ERR! Response timeout while trying to fetch https://registry.npmjs.org/emoji-regex (over 30000ms)
Two issues here.这里有两个问题。 The first, relating to the So this happens when you have an interruption in connection and you were in the middle of parsing some of those JSON files during an install.
第一个,关于 所以当你连接中断并且你在安装过程中正在解析其中一些 JSON 文件时,就会发生这种情况。 They are supposed to auto repair but sometimes you will need to:
他们应该自动修理,但有时您需要:
npm cache clean --force
to clear down the cache manually. npm cache clean --force
--强制手动清除缓存。
The second is due to the fact you have not set a registry to pull the packages from.第二个是因为您没有设置注册表来从中提取包。
npm config set registry "https://registry.npmjs.com/"
Then you will need to reinstall with npm install -g gatsby-cli
npm config set registry "https://registry.npmjs.com/"
然后你需要重新安装npm install -g gatsby-cli
I have to change the registry of npm.我必须更改 npm 的注册表。
npm config set registry "https://registry.npmjs.com/"
Then clear the cache.然后清除缓存。
npm cache clean --force
And finally run the gatsby installer.最后运行 gatsby 安装程序。
npm install -g gatsby-cli
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.