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?
Asked
Active
Viewed 8,464 times
18
-
1did you check if anything was bound the port? – Marc B Jul 13 '16 at 17:19
-
1I'm sure it's previous instance of application is using the port. Because server on localhost is still working – Alexander Doloz Jul 13 '16 at 17:23
2 Answers
45
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

tanner0101
- 4,005
- 19
- 33
-
-
Hi @Tanner I've tried given solution by you. But even after killing so many instances still getting same error. How to identify which instance need to kill? Any identification for instance? – Hrishikesh Oct 29 '16 at 16:35
-
1
-
@AdamBardon Thank you so much... your answer help me a lot and its working now. – Hrishikesh Dec 02 '16 at 05:46
1
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.

Adam Bardon
- 3,829
- 7
- 38
- 73