Rishabh Guha
Rishabh Guha

Reputation: 77

npm ERR! Unexpected end of JSON input while parsing near '

So this error randomly popped up while I was working on my project:

enter image description here

I've searched online and most of the answers ask to run npm cache clean --force. This did not work for me :(

I've also tried to reinstall npm but still get the same error.

Here is the error-log:

Error-verbose

I've been stuck on this for a while hoping someone can help me out :/

Upvotes: 0

Views: 3605

Answers (4)

kashgo
kashgo

Reputation: 159

For my Vue.js project this problem was solved by first deleting the package-lock.json file and then running npm install

Comment from @user2864740 helped point me in this direction, thank you!

Upvotes: 0

Muhammed Moussa
Muhammed Moussa

Reputation: 5205

try npm cache clean --force, fixed the issue for me.

ref: npm-err-unexpected-end-of-json-input-while-parsing-near-743

Upvotes: 1

GuiGNG
GuiGNG

Reputation: 109

You can try "yarn" instead of npm.

Installation (If you are using Mac):

brew install yarn

Or check here https://classic.yarnpkg.com/en/docs/install/

Then just run (Works like "npm install")

yarn

Upvotes: 1

antonyftp
antonyftp

Reputation: 70

You should try to reinstall entirely nodejs from your computer. This could solve the problem.

sudo apt-get remove nodejs
sudo apt-get install nodejs

Upvotes: 1

Related Questions