简体   繁体   中英

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. I just finished formatting my PC and setup the development environment. Anyone can help?

node v12.16.2

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 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. They are supposed to auto repair but sometimes you will need to:

npm cache clean --force to clear down the cache manually.

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

I have to change the registry of npm.

npm config set registry "https://registry.npmjs.com/"

Then clear the cache.

npm cache clean --force

And finally run the gatsby installer.

npm install -g gatsby-cli

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM