I have a project which perfectly works in WebStorm on windows. When trying the same on Mac, I got EACCES error trying https with default (443) port
我有一个在Windows上的WebStorm中完美运行的项目。在Mac上尝试相同时,我在使用默认(443)端口尝试https时出现EACCES错误
Playing around, I noticed that running
到处玩,我注意到了跑步
sudo node app.js
works nice. Doing the same without sudo throws EACCES. And I cannot run project from WebStorm, because it runs node without sudo access
效果很好。没有sudo就这样做会抛出EACCES。我无法从WebStorm运行项目,因为它运行没有sudo访问的节点
Of course, trying any higher port (e.g. 3000) works perfectly. But I work for a while and all environments need 443 port in this case.
当然,尝试任何更高端口(例如3000)都可以完美地工作。但是我工作了一段时间,在这种情况下所有环境都需要443端口。
I understand that it's something with admin permissions. Any way to make it working when run within my IDE? Something like "always run node as an admin"? I'm new to Mac, so have no idea how to do that.
我知道这是管理员权限。在我的IDE中运行时,是否有任何方法可以使其工作?像“总是以管理员身份运行节点”之类的东西?我是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. So, it's not the reason of the issue.
同样,此代码在Windows和Mac中都可以使用root访问权限。所以,这不是问题的原因。
Your help is very appreciated!
非常感谢您的帮助!
2 个解决方案
#1
3
Submitted request to enable running node.js from WebStorm as sudo: http://youtrack.jetbrains.com/issue/WEB-11972
提交请求以启用从WebStorm运行node.js作为sudo: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
#2
0
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另一种可能的方法这是运行WebStorm本身作为sudo ...
Anyway, please feel free to file a request for a possibility to run node as sudo to youtrack, http://youtrack.jetbrains.com/issues/WEB
无论如何,请随时向youtrack提交运行节点作为sudo的可能性的请求,http://youtrack.jetbrains.com/issues/WEB
#1
3
Submitted request to enable running node.js from WebStorm as sudo: http://youtrack.jetbrains.com/issue/WEB-11972
提交请求以启用从WebStorm运行node.js作为sudo: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
#2
0
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另一种可能的方法这是运行WebStorm本身作为sudo ...
Anyway, please feel free to file a request for a possibility to run node as sudo to youtrack, http://youtrack.jetbrains.com/issues/WEB
无论如何,请随时向youtrack提交运行节点作为sudo的可能性的请求,http://youtrack.jetbrains.com/issues/WEB