错误:收听EACCES 0.0.0.0:443 [英] Error: listen EACCES 0.0.0.0:443
问题描述
我正在尝试在MacOS上通过NodeJS运行一个Web项目.
I am trying to run a web project by NodeJS on my MacOS.
npm install
之后,npm start
返回错误
events.js:183
throw er; // Unhandled 'error' event
^
Error: listen EACCES 0.0.0.0:443
at Object._errnoException (util.js:1024:11)
at _exceptionWithHostPort (util.js:1046:20)
at Server.setupListenHandle [as _listen2] (net.js:1334:19)
at listenInCluster (net.js:1392:12)
at Server.listen (net.js:1476:7)
at Object.<anonymous> (/Users/softtimur/Startup/PRODSERVER/tmp/WeCard/models/www:36:8)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Function.Module.runMain (module.js:676:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
我的Mac上没有其他网站正在运行.
No other website is running on my Mac.
有人知道怎么了吗?我需要在Mac上进行配置吗?
Does anyone know what's wrong? Do I need to configure something on my Mac?
sudo npm start
返回
events.js:183
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE :::443
at Object._errnoException (util.js:1024:11)
at _exceptionWithHostPort (util.js:1046:20)
at Server.setupListenHandle [as _listen2] (net.js:1351:14)
at listenInCluster (net.js:1392:12)
at Server.listen (net.js:1476:7)
at Object.<anonymous> (/Users/softtimur/Startup/PRODSERVER/tmp/WeCard/models/www:36:8)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Function.Module.runMain (module.js:676:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
推荐答案
为了侦听特权端口,您需要root权限才能启动服务器.这适用于端口< 1024.您可以将nginx用作在443上运行的反向代理服务器,并以非特权用户的身份在非特权端口上同时运行Node JS服务器.
In order to listen on privileged ports you need root permissions to start the server; this applies to ports < 1024. You may use nginx as a reverse proxy server running on 443 and run your Node JS server alongside on non-privileged ports as an unprivileged user.
有关在生产中使用nginx设置Node JS应用程序的更多信息,请访问以下链接: https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-centos-7
For more information on setting up Node JS application with nginx in production, follow the link: https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-centos-7
这篇关于错误:收听EACCES 0.0.0.0:443的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!