Abhimanyu
Abhimanyu

Reputation: 14767

npm ERR! Unexpected end of JSON input while parsing

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

Upvotes: 2

Views: 26507

Answers (6)

Shashi Kiran
Shashi Kiran

Reputation: 367

You need to delete package-lock.json and try installing again.

Upvotes: 0

Abi Chhetri
Abi Chhetri

Reputation: 1437

delete node_modules folder
delete package-lock.json 
npm clear cache -f
npm i

Upvotes: 0

Pavneet Kaur
Pavneet Kaur

Reputation: 787

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.

Upvotes: 4

Hussam Adil
Hussam Adil

Reputation: 540

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

Upvotes: 2

Myth
Myth

Reputation: 201

You do not need to uninstall or install anything. Just

npm cache clean --force

and then

npm install

will do.

Upvotes: 15

Sunny Goel
Sunny Goel

Reputation: 2132

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.

Upvotes: 1

Related Questions