0

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 :/

2
  • 2
    Looks like the package-lock.json file has been corrupted. Fix it to be valid JSON. Commented Sep 17, 2020 at 19:12
  • 1
    @user2864740 brother you are a life saver. This worked for me, very weird tho, do you have any idea how this might have happened? Commented Sep 17, 2020 at 22:25

4 Answers 4

1

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
Sign up to request clarification or add additional context in comments.

Comments

1

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

Comments

1

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

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

Comments

0

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!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.