Npm install error Unexpected end of JSON

in #node6 years ago

some time last two months I tried to delve into angular Js and I ran npm install, installations were going smoothly until the network broke. now subsequent attempt to run the command even in Laravel projects were giving the same error thus laravel mix was never in place. Now the issue you probably would have with this error is that the console also throws the "gulp deprecation warning" so you go online searching solutions to gulp or you might even try to and search the whole error. trust me the search filter would overwhelm you. So today I want to give you quick and accurate solutions to this problem.

Understanding of the problem.

This problem occurs because you now have a cache in your npm-cache that is incomplete and any new install command would search the cache first to see if there is a cached file in your system.

Solution
step 1: run "npm cache clean --force" : this command clears your npm cache memory
step 2: upgrade by running "npm install npm@latest -g"
step 3: now run the npm install command

you can now proceed to run "npm run dev" and "npm run watch"

The solution given here is suitable for "npm run dev " issue where a required package is missing.
Sample Image

Screenshot (16).png
[Screenshot (15).png](https://cdn.steemitimages.com/DQmcGA4Po8shKPhWzRRXy9oFmJ5UTzfYbiugznU1VKi1nm7/Screenshot%20(15).png

Coin Marketplace

STEEM 0.27
TRX 0.11
JST 0.031
BTC 67411.34
ETH 3684.87
USDT 1.00
SBD 3.75