nodemon throws 'address already in use' after few file changes/restarts. Simple solution is to kill the port with kill -9 3000 (use the appr. port number). But we wouldn't stop at that, would we?create a nodemon.json file in the root with the below config.
"restart": "kill -9 $(lsof -t -i:3000)", "crash": "kill -9 $(lsof -t -i:3000)"
change the port number accordingly.
we are hooking kill -9 $(lsof -t -i:3000) command to restart/crash events of nodemon which finds the process id running on the given port number and kills it.