在 Mint Maya 64 上,如果我在终端中运行“node index.js”(v0.10.21),我会收到此错误:
events.js:72
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE
at errnoException (net.js:901:11)
at Server._listen2 (net.js:1039:14)
at listen (net.js:1061:10)
at Server.listen (net.js:1127:5)
at Object.<anonymous> (/home/USER/Desktop/server/index.js:73:24)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
我的apache2服务器停止了,没有其他 Node 服务器在运行。
我试过“killall node” -> node: no process found
使用“sudo netstat -tulpn”,没有任何迹象表明在端口 80 上有任何监听。
因为这是我的第一个 Node 服务器实验,所以我不知道如何进行。
最佳答案
首先在您的 index.js 文件中检查 Node 使用的端口。 有另一个应用程序使用此端口。 所以你有两个选择:
- 终止此应用
- 为 Node 应用使用另一个端口
关于linux - Node 服务器错误时 "node index.js"(EADDRINUSE),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20865886/