Create amazing web applications!

Npm Err Invalid Json Response Body Unexpected End of Json Input

How to fix NPM ERR Invalid Response Body with unexpected json input when doing NPM Install.

by Anthony Pillos 1 minute

npm-install npm npm-err error-install npm-clear

Npm Err Invalid Json Response Body Unexpected End of Json Input

While trying to setup a new Laravel 8.x projects, We encountered problem while doing NPM install.

Npm Err Invalid Json Response Body Unexpected End of Json Input

Error:

npm install;
npm ERR! code FETCH_ERROR
npm ERR! errno FETCH_ERROR
npm ERR! invalid json response body at https://registry.npmjs.org/browserslist reason: Unexpected end of JSON input

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/letsodepare/.npm/_logs/2021-07-06T06_55_29_873Z-debug.log

Don't worry, it's natural I'm here to help you to fix this kind of error.

To the Rescue

Solution:

Just run the following command, to clear you local npm cache folder.

npm cache clean --force

That kind of error, happened when your network is not stable and cannot connect to NPM servers properly. Those download resources is not complete which give an invalid json format.

Now, try to run npm install it should work by now.

Voila!!!

I hope you enjoy our tutorial, Let me know incase you encounter any error I would love to answer that. Don't forget to subscribe to my Youtube Channel at Let's Code Pare - Youtube Channel

Buy Me A Coffee

Share Now

Want to get more 🔥 tips like this one?

Subscribe to get notified for our new dev tutorials

Let's Code Pare
Let's Code Pare Youtube Channel