Sometimes I get this error when trying to run a Vapor application from Xcode. Reopening Xcode doesn't help, only restarting of system do. Is it a bug of the framework? What should I do to prevent this?
If using sudo
does not fix this message, it means something is already bound to this port. It could be an instance of Vapor that didn't close correctly.
To fix this, you need to kill the previous instance. The easiest way to do this is:
lsof -i tcp:8080
Where 8080
is the port you are trying to use. This outputs something like:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
com.apple 4679 tanner 8u IPv4 0x890f6b0b31966939 0t0 TCP
Then kill the process bound to that port using its PID
.
kill -9 4679
While Tanner's answer should help in most cases, for me the kill
command had no effect and no output. So I completely quitted & restarted terminal.
When running lsof
there were no processes found anymore, and issue was solved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With