为什么会出现这个错误:Error: connect ECONNREFUSED?

问题描述 投票:0回答:1

我正在尝试连接到 API Mailchimp,但在启动

app.js
时出现此错误。

import mailchimp from "@mailchimp/mailchimp_marketing";

mailchimp.setConfig({
  apiKey: "apiKey",
  server: "server",
});

async function run() {
  const response = await mailchimp.ping.get();
  console.log(response);
}

run();

这是完整的错误:

(node:27226) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 0.0.0.0:443
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1144:16)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:27226) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:27226) [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.
javascript node.js api mailchimp
1个回答
0
投票

ECONNREFUSED
表示您的操作系统无法建立 TCP 连接。
0.0.0.0:443
上没有监听任何服务,这是您自己的计算机。您确定
0.0.0.0
是您需要连接的主机吗?

您需要在计算机上启动所需的服务,或者需要使用正确的 IP 地址(无论是什么)。

© www.soinside.com 2019 - 2024. All rights reserved.