Sometimes when we run gulp serve for spfx especially on mac we will see the error

‘serve’ errored after 362 ms


Error: listen EADDRINUSE: address already in use :::5432

First list out the services which using 5432 with below command in terminal.

sudo lsof -i :5432

We need to kill the process with PID number.

Kill -9 PID