DEV Community

Damanpreet Singh
Damanpreet Singh

Posted on

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

Actual Behavior:

User tries to install npm packages using npm i, and gets an error message saying:

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

Possible Solutions:
  • Clear the npm cache:
npm cache clean --force
Enter fullscreen mode Exit fullscreen mode
  • Try updating to the latest npm:
npm i npm@latest -g
Enter fullscreen mode Exit fullscreen mode
  • Try deleting package-lock.json file. It keeps track of exact version of every package that is installed.
rm package-lock.json
Enter fullscreen mode Exit fullscreen mode

Top comments (0)