While trying to setup a new Laravel 8.x projects, We encountered problem while doing NPM install.
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.
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
