npm ERR! Unexpected end of JSON input while parsing

24,062

Solution 1

You do not need to uninstall or install anything. Just

npm cache clean --force

and then

npm install

will do.

Solution 2

In the folder where you have tried to create project setup, just run these 2 commands:

  1. npm cache clean --force
  2. npm install

Afterwards, run the commands needed to setup your project directory.

Solution 3

This issue was solved by going to C:\Users\USERNAME\AppData\Roaming\npm-cache and deleting its contents manually , then later running cmd as Administrator and running npm install

Solution 4

open the cmd in adminstator mode then run the following commands in order specify

npm cache clean --force 
go in the c:/user/user_name/AppData/Roaming/npm     => clean this folder 
npm install -g @angular/cli
ng new project_name

Hope it will work.

Share:
24,062

Related videos on Youtube

Abhimanyu
Author by

Abhimanyu

Android Dev @ GRAB To connect with me - Linked In

Updated on October 24, 2021

Comments

  • Abhimanyu
    Abhimanyu over 2 years

    Got the following error while executing ng new project-name in angular project

    npm WARN deprecated [email protected]: CircularJSON is in maintenance only, flatted is its successor.
    npm ERR! Unexpected end of JSON input while parsing near '...:"~0.0.0","webpack-de'

    npm ERR! A complete log of this run can be found in:
    npm ERR! C:\Users\Abhi\AppData\Roaming\npm-cache_logs\2018-12-13T10_24_02_151Z-debug.log
    Package install failed, see above.

    What I have tried :
    1. npm cache clean --force
    2. npm cache verify
    3. npm ERR! Unexpected end of JSON input while parsing near '...5.0","rimraf":"^2.2.8'

    Current Versions:
    Node : 10.14.2
    NPM : 6.5.0
    OS : Windows

    • Abhishek
      Abhishek over 5 years
      have try this npm uninstall -g angular-cli npm cache clean after that npm install -g angular-cli after that try
    • Abhimanyu
      Abhimanyu over 5 years
      @Abhishek Getting same error while installing angular-cli
    • Patrick Hollweck
      Patrick Hollweck over 5 years
      Post your package.json file
    • Abhimanyu
      Abhimanyu over 5 years
      @PatrickHollweck I am new to Angular.Can you please tell me where can find that file?
  • xskxzr
    xskxzr about 5 years
    What's the difference from other existing answers?
  • Myth
    Myth about 5 years
    You do not need to uninstall or install anything just npm cache clean --force and then npm install will do