首页 > 解决方案 > node.js 错误:连接 EADDRINUSE 104.16.58.5:443

问题描述

完整错误:

    (node:8852) UnhandledPromiseRejectionWarning: Error: connect EADDRINUSE 104.16.58.5:443
    at Object._errnoException (util.js:1022:11)
    at _exceptionWithHostPort (util.js:1044:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1198:14)
(node:8852) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:8852) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

我安装的节点模块:

其他信息:

标签: node.js

解决方案


正如错误所说的 EADDRINUSE - 意味着您的应用程序使用的端口已被其他进程使用(某些 http 服务器使用 443 作为 http 默认端口)

您可以将端口从 443 更改,或者您可以找到使用此端口的进程并验证是否需要此进程

要在 Linux 上查找进程,请运行:

netstat -an | grep :443

第二列会告诉你哪个 processId 使用这个端口

在 Windows 上:

netstat -aon | findstr 443

推荐阅读