← Blog

How to fix frequent nodemon error: address in use

August 08, 2019

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.

    "events": {
        "restart": "kill -9 $(lsof -t -i:3000)",
        "crash": "kill -9 $(lsof -t -i:3000)"
    "delay": 100

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.

Kyle Mathews

Written by Sai Krishna who loves to build new stuff. Sometimes not really useful but cool stuff. Previously built SpotPlay, mHotspot, reymusic.co
You can find him on Twitter and Github

Built with GatsbyJS. Hosted on Netlify.