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
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
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.
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.
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.
Your help is very appreciated!