简体   繁体   English

npm 错误。 在“...tore-4.0.0,tgz”,“文件”附近解析时输入意外结束 JSON

[英]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.

相关问题 npm 错误! 解析 &#39; 附近时 JSON 输入意外结束 - npm ERR! Unexpected end of JSON input while parsing near ' npm 错误! 在“…w2BfLygJAO9ZBvYIqZTld”附近解析时 JSON 输入意外结束 - npm ERR! Unexpected end of JSON input while parsing near '…w2BfLygJAO9ZBvYIqZTld' Angular ng 新投掷错误:npm ERR! 解析附近时 JSON 输入意外结束 - Angular ng new throwing error: npm ERR! Unexpected end of JSON input while parsing near “npm ERR,在附近解析时 JSON 输入意外结束”。 在安装 express.js 时 - “npm ERR! Unexpected end of JSON input while parsing near”, while installing express.js npm ERR:JSON 输入意外结束,同时在 '...nt“.”^7.1,0“,”babel-p' 附近解析 - npm ERR! Unexpected end of JSON input while parsing near '…nt“:”^7.1.0“,”babel-p' npm 错误! 解析 &#39;...&quot;jscs&quot;:&quot;~3.0.7&quot;,&quot;moch&#39; 附近时 JSON 输入意外结束 - npm ERR! Unexpected end of JSON input while parsing near '..."jscs":"~3.0.7","moch' npm 错误! 在 &#39;...ob&quot;:&quot;^7.0.0&quot;,&quot;istanbu&#39; 附近解析时 JSON 输入意外结束 - npm ERR! Unexpected end of JSON input while parsing near '...ob":"^7.0.0","istanbu' npm 错误! 解析 &#39;.../openpgpjs.org\\r\\n\\r\\&#39; 附近时 JSON 输入意外结束 - npm ERR! Unexpected end of JSON input while parsing near '.../openpgpjs.org\r\n\r\' npm 错误! 解析 &#39;...registry.npmjs.org/@i&#39; 附近时 JSON 输入意外结束 - npm ERR! Unexpected end of JSON input while parsing near '...registry.npmjs.org/@i' npm 安装错误在解析附近时 JSON 输入意外结束 - npm install error Unexpected end of JSON input while parsing near
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM