Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 206
DilipCoder Avatar asked May 05 '18 11:05

DilipCoder


1 Answers

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:

  • https://registry.npmjs.org/ (Dfault One)
  • http://r.cnpmjs.org/
  • https://registry.npm.taobao.org/
  • https://registry.nodejitsu.com/
  • http://registry.mirror.cqupt.edu.cn
  • https://skimdb.npmjs.com/registry
  • https://npm.open-registry.dev/ (https://open-registry.dev)

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.

    like image 90
    DilipCoder Avatar answered Oct 09 '22 14:10

    DilipCoder