Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
704 views
in Technique[技术] by (71.8m points)

reactjs - Installing create-react-app gives npm ERR! shasum check failed and npm ERR! Unexpected end of JSON input while parsing near '...mojOzGIEI2rg0m24Yb5Oq'

Errors when i use sudo npm install create-react-app -g npm ERR! Linux 4.13.0-39-generic npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "i" "create-react-app" "-g" npm ERR! node v6.11.4 npm ERR! npm v3.5.2

npm ERR! shasum check failed for /tmp/npm-16477-77596b49/registry.npmjs.org/tar/-/tar-2.2.1.tgz npm ERR! Expected: 8e4d2a256c0e2185c6b18ad694aec968b83cb1d1 npm ERR! Actual: 5eb06eb521673d0940a4deb11baf89d62647f193 npm ERR! From: https://registry.npmjs.org/tar/-/tar-2.2.1.tgz

when use npm install create-react-app - npm-version : 6.0.0 - node-version: 8.11.1 error is:
npm ERR! Unexpected end of JSON input while parsing near '...mojOzGIEI2rg0m24Yb5Oq'

npm ERR! A complete log of this run can be found in: npm ERR! /home/dilipcoder/.npm/_logs/2018-05-05T11_34_14_721Z-debug.log

i have already tried these options

  • npm cache clean --force
  • reinstalling npm and node
  • switching different version of npm

error which I get while installing create-react-app other packages installed properly

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

the error npm ERR! shasum check failed and npm ERR! Unexpected end of JSON input while parsing near'....' ,   will be solved by switching npm reigistry from the list of given npm registry.

List of Npm registry:

To switch just type

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

Replace the registry url with the above urls check which one works for you.

After That:

npm cache clear --force npm cache verify

now error will be solved.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...