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
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)
Worked for me thanks
This helps
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 osI use Angular and I don't see solutions for it. Please help me
Thank you, al work like Hero. I did not know so much cache for npm. thanks.
It's working. Thanks, a lot for this easy way to solve this problem. May Allah bless you brother.
I'm on windows. Clearing my cache and then deleting files in the folder above worked for me. Thanks!
It was the only thing that worked.
Thanks.
first run
npm i -g create-react-app
then it will update and remove some package in this directly to
Nice!!! Thanks Ankush.
Thanks alot. I had issues installing gulp-cli, this solution fixed it
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.
This fixed the error. thank you so much for the instructions!
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.
thanksss dude... a lott.....
@rishiabee - thank you!!!
I joined DEV just so I could post this. Lifesaver.