解决思路:既然端口被占用了那么就看被那个进程占用了,然后kill调那个进程即可!
Mac OS 环境
#查看某个端口是否占用比如8081:
lsof -i:8081
#显示如下信息:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
node 26266 hehuiqi 20u IPv6 0xdb980f4c9bbe8dd3 0t0 TCP *:sunproxyadmin (LISTEN)
node 26266 hehuiqi 33u IPv6 0xdb980f4c9bbe5fd3 0t0 TCP localhost:sunproxyadmin->localhost:56349 (ESTABLISHED)
HelloWord 26273 hehuiqi 10u IPv4 0xdb980f4c88f21f9b 0t0 TCP localhost:56349->localhost:sunproxyadmin (ESTABLISHED)
HelloWord 26273 hehuiqi 12u IPv4 0xdb980f4c88f21f9b 0t0 TCP localhost:56349->localhost:sunproxyadmin (ESTABLISHED)
# COMMAND:进程名 PID:进程ID
#找到了占用端口的进程,那就kill它就可以了 kill PID
kill 26266 26273
#重新运行项目即可
网友评论