【发布时间】:2021-01-20 04:07:20
【问题描述】:
我正在尝试使用以下代码连接到 API mailchimp:
const client = require('@mailchimp/mailchimp_marketing');
client.setConfig({
apiKey: "MY API KEY",
server: "MY SERVER",
});
async function run() {
const response = await client.ping.get();
console.log(response);
}
run();
在我的代码中,我有真正的 API KEY 和 SERVER,但我在这里放了一个假的。
在我运行 main.js 之后,我遇到了这个错误,我不知道如何解决它:
(node:28092) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: connect ECONNREFUSED 72.9.105.30:443
(node:28092) [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.
我已经通过以下方式安装了 mailchimp:
npm install mailchimp
但是错误还是来了。
【问题讨论】:
标签: javascript node.js api npm mailchimp