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

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

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

Then...

npm cache verify

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

npm i npm@latest -g

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
 
_andwati profile image
Ian Andwati

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

Collapse
 
binel01 profile image
Binel binel

This really helped me. I was facing that issue when trying to create a new Angular project and an ionic project. After cleaning my NPM cache, I successfully installed the ionic app.

Thank you very much.

Collapse
 
moojob profile image
Moojob

This fixed the error. thank you so much for the instructions!

Collapse
 
stasdomanskyi profile image
Stanislav Domanskyi

Thank you! I had the same issue with executing npm i -g @loopback/cli

It has helped me but first I switched through the nvm from node v12.19.0 to 10.22.1
After following all above instructions finally I've got this package.

Collapse
 
curlylazy profile image
Curly Lazy

thanksss dude... a lott.....

Collapse
 
doublejointed profile image
doublejointed

@rishiabee - thank you!!!

I joined DEV just so I could post this. Lifesaver.