Error Unexpected end of JSON input while parsing near '...ge-2.2.1.tgz"},"engin'

13,315

Solution 1

npm cache clean --force 

Then :

npm install -g @angular/cli

If not working :

Delete package.lock.json file and try again

Solution 2

I started facing this issue after upgrading npm package.

You can resolve this with: npm cache clean --force

voila, reinstall the package.

Share:
13,315
Arvind Gautam
Author by

Arvind Gautam

Updated on September 15, 2022

Comments

  • Arvind Gautam
    Arvind Gautam over 1 year

    Command:

    npm install -g @angular/cli@latest
    

    Exception:

    verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...ge-2.2.1.tgz"},"engin' 169 verbose stack at JSON.parse () 169 verbose stack at parseJson (C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\node_modules\make-fetch-happen\node_modules\node-fetch-npm\node_modules\json-parse-better-errors\index.js:7:17) 169 verbose stack at consumeBody.call.then.buffer (C:\Program Files\nodejs\node_modules\npm\node_modules\pacote\node_modules\make-fetch-happen\node_modules\node-fetch-npm\src\body.js:96:50) 169 verbose stack at 169 verbose stack at process._tickCallback (internal/process/next_tick.js:188:7)


    Looking for help and support. Thanks

  • Arvind Gautam
    Arvind Gautam over 5 years
    After following the above steps, got error:npm ERR! Unexpected end of JSON input while parsing near '...://registry.npmjs.org'
  • willmaz
    willmaz over 5 years
    delete package.lock.json file and try again