DEV Community

Cover image for npm ERR! Unexpected end of JSON input while parsing near
Rishi
Rishi

Posted on

npm ERR! Unexpected end of JSON input while parsing near

You are trying to create a new angular, react, vue app, and you end up with an error message saying:

npm ERR! Unexpected end of JSON input while parsing near

Alt Text

There's a high chance that your npm cache been damaged.

Try:



npm cache clean --force


Enter fullscreen mode Exit fullscreen mode

If you are a windows user, try deleting all files in this folder:



C:\Users{{your-username}}\AppData\Roaming\npm-cache


Enter fullscreen mode Exit fullscreen mode

Then...



npm cache verify


Enter fullscreen mode Exit fullscreen mode

If that doesn't work, try updating to the lastest (understand the risks)



npm i npm@latest -g


Enter fullscreen mode Exit fullscreen mode

I hope this helps!

Latest comments (45)

Collapse
 
njezeoj profile image
NjezeOj

Worked for me thanks

Collapse
 
bbalaji64616464 profile image
B balaji

This helps

Collapse
 
habimanasharif profile image
habimanasharif

i had also struggled with this error and this and i have solved this error by using running the command npm install in an adminstrator terminal and it worked on ubuntu os

Collapse
 
davidakinjames profile image
Akinwande Akin-James

I use Angular and I don't see solutions for it. Please help me

Collapse
 
alicankal profile image
Cankal Software

Thank you, al work like Hero. I did not know so much cache for npm. thanks.

Collapse
 
masud309060 profile image
Md Masud Rana

It's working. Thanks, a lot for this easy way to solve this problem. May Allah bless you brother.

Collapse
 
zacharydinerstein profile image
Zachary Dinerstein

I'm on windows. Clearing my cache and then deleting files in the folder above worked for me. Thanks!

Collapse
 
brdionel profile image
Bruno Dionel Vicente

It was the only thing that worked.
Thanks.

Collapse
 
anproghub profile image
Ankush Chauhan • Edited

first run

npm i -g create-react-app

image1
then it will update and remove some package in this directly to




**Then your can easily run**

 ```npx create-react-app my-app```



and it will works !!!!!
Enter fullscreen mode Exit fullscreen mode
Collapse
 
rishiabee profile image
Rishi

Nice!!! Thanks Ankush.

Collapse
 
mockingspectre profile image
mockinspectre

Thanks alot. I had issues installing gulp-cli, this solution fixed it