错误:getaddrinfo ENOTFOUND [英] Error: getaddrinfo ENOTFOUND

查看:4398
本文介绍了错误:getaddrinfo ENOTFOUND的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的Node.js机器人,该机器人每秒向其余API发出一个HTTP请求.

I have a simple Node.js bot that makes an HTTP request each second to a rest API.

如果返回的数据正确,则在HTTP POST处构造一个URL.

If the returned data is right then I construct an URL where I HTTP POST.

一切正常,但是运行约4-5小时后,我收到了此错误

Everything works alright but after ~4-5hrs of running I got this error

0|server   | error:  Error: getaddrinfo ENOTFOUND www.rest-api.com www.rest-api.com:443
0|server   |     at errnoException (dns.js:28:10)
0|server   |     at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:73:26)

有人可以向我解释为什么会这样吗?

Can someone explain to me why this has happened?

重新启动服务器后,一切正常.

After I restart my server everything got working.

我正在使用 axios 发出http请求.

I'm using axios to make the http requests.

推荐答案

我遇到了相同的问题并解决了!

I met the same issue and solved it!

尝试:

sudo vi /etc/hosts

并添加:

127.0.0.1本地主机

127.0.0.1 localhost

主持人

这篇关于错误:getaddrinfo ENOTFOUND的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆