MAC端口被占用的解决方法

 

运行Node.js项目的时候,报错

 
 
 
x
 
 
 
 
Error: listen EADDRINUSE :::10000
    at Object.exports._errnoException (util.js:911:11)
    at exports._exceptionWithHostPort (util.js:934:20)
    at Server._listen2 (net.js:1248:14)
    at listen (net.js:1284:10)
    at Server.listen (net.js:1380:5)
    at Object.exports.start (/Users/liwang/Desktop/babykylin_scmj-master/server/game_server/socket_service.js:30:13)
    at Object.<anonymous> (/Users/liwang/Desktop/babykylin_scmj-master/server/game_server/app.js:15:16)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
 

报错原因:端口被占用

解决方式:

方法一:更换端口号

方法二:找出占用端口程序,kill掉

 
 
 
x
 
 
 
 
✗ sudo lsof -n -P | grep :10000
Password:
GoAgentX  2659          zhaotf   20u     IPv4 0xe877a1e121c8c2cb        0t0      TCP *:10000 (LISTEN)
GoAgentX  2659          zhaotf   21u     IPv6 0xe877a1e12174845b        0t0      TCP *:10000 (LISTEN)
--------------------- 
posted @ 2018-10-12 09:34  AliliWl  阅读(2512)  评论(0编辑  收藏  举报