Error: listen EADDRINUSE: address already in use 0.0.0.0:XXXX
Mon, Jan 2, 2023
When you try to start a server on a port that is already being used by another program, you will get the following error:
MAKINOTE$ yarn startyarn run v1.22.19$ next startError: listen EADDRINUSE: address already in use 0.0.0.0:3000 at Server.setupListenHandle [as _listen2] (node:net:1432:16) at listenInCluster (node:net:1480:12) at doListen (node:net:1629:7) at processTicksAndRejections (node:internal/process/task_queues:84:21) { code: 'EADDRINUSE', errno: -48, syscall: 'listen', address: '0.0.0.0', port: 3000}
Find the process that is using the port
MAKINOTE$ lsof -i :3000COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAMEnode 38091 xabier.lameirocardam 24u IPv6 0xee02297dd086ebc1 0t0 TCP *:hbci (LISTEN)
Kill the process
MAKINOTE$ kill -9 38091