简体   繁体   English

什么是“错误:收听EACCES 0.0.0.0:7090”?

[英]what is 'Error: listen EACCES 0.0.0.0:7090'?

I'm doing to run nodejs server on windows server 2012. App port is 7090. This is part of the server.js file: 我正在Windows Server 2012上运行nodejs服务器。应用程序端口为7090。这是server.js文件的一部分:

var port    = process.env.PORT || 7090;
app.listen(port, function() {
  console.log('Listening on port ' + port);
});

When I run it with node server.js ,I get this error: 当我使用node server.js运行它时,出现以下错误:

Error: listen EACCES 0.0.0.0:7090
    at Object.exports._errnoException (util.js:1008:11)
    at exports._exceptionWithHostPort (util.js:1031:20)
    at Server._listen2 (net.js:1240:19)
    at listen (net.js:1289:10)
    at Server.listen (net.js:1385:5)
    at EventEmitter.listen (D:\STH\node_modules\express\lib\application.js:617:24)
    at Object.<anonymous> (D:\STH\app.js:26:5)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)

​It works when I change port to any other numbers except 7090. ``当我将端口更改为7090以外的任何其他数字时,它可以工作。

Error: listen EACCES 0.0.0.0:7090 I know already, that the Error EACCES means that i don't have access rights to the port 7090 according to this question, but i don't know how to fix this. 错误:收听EACCES 0.0.0.0:7090我已经知道,错误EACCES意味着我没有根据问题对端口7090的访问权限,但我不知道如何解决此问题。 Any help much appreciated! 任何帮助,不胜感激!

this means that something else (probably your app) is already running on that port. 这意味着该端口上已经在运行其他程序(可能是您的应用程序)。 Maybe you run it in background or as another user and can't restore it right now. 也许您是在后台或以其他用户身份运行它,但现在无法还原。 You can look up who is using the port by using netstat on windows server: https://technet.microsoft.com/en-us/library/ff961504(v=ws.11).aspx 您可以使用Windows服务器上的netstat来查找谁在使用该端口: https : //technet.microsoft.com/zh-cn/library/ff961504(v= ws.11).aspx

lsof -i:7090

然后找到PID

kill -9 PID

Issue fixed! 问题已解决! That port is already listening by IISNode unexpectedly. 该端口已被IISNode意外侦听。 I just deleted it and now ok to run on port 7090. 我刚刚删除了它,现在可以在端口7090上运行了。

当我尝试在服务器上运行节点应用程序时,我遇到了同样的问题,但幸运的是,经过很少的搜索后,我找到了解决方案。我以超级用户的身份使用了节点命令,这很简单,我知道发问者会得到答案,但希望这样做对其他人会有帮助。

sudo node your_app_name.js

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM