简体   繁体   中英

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

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

在此处输入图片说明

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:

错误详细

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

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

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

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

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

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM