7

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

3 Answers 3

21

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.

    0
    0

    "npm cache clean --force" didn't work for me but removing package-lock.json worked. https://github.com/vuejs-templates/webpack/issues/990#issuecomment-395750082

    1
    • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
      – Community Bot
      Sep 21, 2021 at 20:28
    0

    Error:

    SyntaxError: Unexpected end of JSON input while parsing near

    Removing package-lock.json worked for me.

    Add Powershell script or Linux script as below,

    Powershell:

    Remove-Item package-lock.json  -Force
    

    Linux:

    rm -rf package-lock.json
    

    Path In Azure Devops:

    $(System.DefaultWorkingDirectory)\appName\appName\ClientApp\node_modules'
    

    Note - appName is an example you can add a path as per your source code.

    Your Answer

    By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

    Not the answer you're looking for? Browse other questions tagged or ask your own question.