简体   繁体   English

如何使用mailchimp API解决“错误:连接ECONNREFUSED”

[英]How to solve "Error: connect ECONNREFUSED" using mailchimp API

I'm trying to connect to the API mailchimp by using this code:我正在尝试使用以下代码连接到 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();

In my code, I have the real API KEY and SERVER but I put fake one in here.在我的代码中,我有真正的 API KEY 和 SERVER,但我在这里放了假的。

After I run my main.js, I have this error that come and I don't know how to solve it:运行 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.

I have already install mailchimp by using:我已经使用以下方法安装了 mailchimp:

npm install mailchimp

But the error still come.但是错误还是来了。

npm install @mailchimp/mailchimp_marketing

check mailchimp_marketing documentation检查mailchimp_marketing 文档

const mailchimp = require('@mailchimp/mailchimp_marketing');
 
mailchimp.setConfig({
  apiKey: 'YOUR_API_KEY',
  server: 'YOUR_SERVER_PREFIX',
});
 
async function callPing() {
  const response = await mailchimp.ping.get();
  console.log(response);
}
 
callPing();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何防止“错误:连接ECONNREFUSED” - How to prevent “Error: connect ECONNREFUSED” 如何使用带有Firebase的ElasticSearch解决``错误:连接ECONNREFUSED 127.0.0.1:9200''? - How to resolve 'Error: connect ECONNREFUSED 127.0.0.1:9200' using ElasticSearch with Firebase? 错误:连接 ECONNREFUSED 185.176.43.99:3306 - Error: connect ECONNREFUSED 185.176.43.99:3306 如何在node.js中找到连接ECONNREFUSED错误的来源? - How to find the source of a connect ECONNREFUSED error in node.js? (节点:25642)未处理的PromiseRejectionWarning:错误:ECONNREFUSED 连接ECONNREFUSED 127.0.0.1:50218 - (node:25642) UnhandledPromiseRejectionWarning: Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:50218 如何从 mail-chimp api 修复超级终端中出现的 MailChimp 401 错误? (使用 JavaScript) - How to fix the MailChimp 401 error which appears in hyper terminal from the mail-chimp api? (using JavaScript) 节点代理错误错误:连接ECONNREFUSED - node proxy error Error: connect ECONNREFUSED 为什么会出现此错误:错误:连接 ECONNREFUSED? - Why this error come: Error: connect ECONNREFUSED? Mailchimp 如何在 javascript 中调用 mailchimp 3.0 API - Mailchimp how to call mailchimp 3.0 API in javascript 获取请求失败,并出现错误:连接ECONNREFUSED - Get Reqeust fails with Error: connect ECONNREFUSED
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM