简体   繁体   English

Mac上的WebStorm node.js EACCES错误443运行端口

[英]WebStorm node.js EACCES error 443 running port on Mac

I have a project which perfectly works in WebStorm on windows. 我有一个可以在Windows上的WebStorm中完美运行的项目。 When trying the same on Mac, I got EACCES error trying https with default (443) port 在Mac上尝试相同操作时,使用默认(443)端口尝试https时出现EACCES错误

Playing around, I noticed that running 玩耍时,我注意到跑步

sudo node app.js 

works nice. 效果很好。 Doing the same without sudo throws EACCES. 在没有sudo的情况下执行相同操作会抛出EACCES。 And I cannot run project from WebStorm, because it runs node without sudo access 而且我无法从WebStorm运行项目,因为它运行的节点没有sudo访问权限

Of course, trying any higher port (eg 3000) works perfectly. 当然,尝试任何更高的端口(例如3000)都可以正常工作。 But I work for a while and all environments need 443 port in this case. 但是我工作了一段时间,在这种情况下,所有环境都需要443端口。

I understand that it's something with admin permissions. 我了解这是具有管理员权限的内容。 Any way to make it working when run within my IDE? 在我的IDE中运行时,有什么方法可以使其正常工作? Something like "always run node as an admin"? 诸如“始终以管理员身份运行节点”之类的东西? I'm new to Mac, so have no idea how to do that. 我是Mac的新手,所以不知道该怎么做。

Exception looks like: 异常看起来像:

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: listen EACCES
    at errnoException (net.js:904:11)
    at Server._listen2 (net.js:1023:19)
    at listen (net.js:1064:10)
    at Server.listen (net.js:1138:5)
    at Object.startServer (/Users/xxxxxx/trunk/server.js:112:21)
    at init (/Users/xxxxxx/trunk/app.js:12:12)
    at Object.<anonymous> (/Users/xxxxxx/trunk/app.js:15:1)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)

Just in case, code to start server: 以防万一,启动服务器的代码:

  var options = {
    key: fs.readFileSync("./server/certificate/xxxxxx.key").toString(),
    cert: fs.readFileSync("./server/certificate/xxxxxx.cert").toString()
  };

  var securedServer = https.createServer(options, function (req, res)
  {
    app.handle(req, res);
  });

  securedServer.listen(config.securePort); //443 in this case

Again, this code works both in windows and in mac with root access. 同样,此代码在Windows和Mac中都可以用root访问。 So, it's not the reason of the issue. 因此,这不是问题的原因。

Your help is very appreciated! 非常感谢您的帮助!

Submitted request to enable running node.js from WebStorm as sudo: http://youtrack.jetbrains.com/issue/WEB-11972 提交的请求,以便从WebStorm运行的node.js的须藤: http://youtrack.jetbrains.com/issue/WEB-11972

Meanwhile, running app at a different port on Mac and configured port forwarding as: 同时,在Mac上的其他端口上运行应用程序,并将端口转发配置为:

sudo ipfw add 101 fwd 127.0.0.1,8443 tcp from any to me 443

I can suggest using port forwarding. 我可以建议使用端口转发。 Please see https://serverfault.com/questions/112795/how-can-i-run-a-server-on-linux-on-port-80-as-a-normal-user for possible workarounds Another possible way to do this is running WebStorm itself as sudo... 请参阅https://serverfault.com/questions/112795/how-can-i-run-a-server-on-linux-on-port-80-as-a-normal-user了解可能的解决方法这样做是作为sudo运行WebStorm本身吗?

Anyway, please feel free to file a request for a possibility to run node as sudo to youtrack, http://youtrack.jetbrains.com/issues/WEB 无论如何,请随时请求以sudo的身份将节点运行到youtrack的请求,网址为http://youtrack.jetbrains.com/issues/WEB

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

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