Error: getaddrinfo ENOTFOUND in nodejs for get call

后端 未结 10 700
离开以前
离开以前 2020-11-30 00:24

I am running a web server on node the code for which is given below

var restify = require(\'restify\');

var server = restify.createServer();

var quotes = [         


        
相关标签:
10条回答
  • 2020-11-30 01:04

    Check host file which like this

    ##
    # Host Database
    #
    # localhost is used to configure the loopback interface
    # when the system is booting.  Do not change this entry.
    ##
    127.0.0.1   localhost
    255.255.255.255 broadcasthost
    
    0 讨论(0)
  • 2020-11-30 01:07

    i have same issue with Amazon server i change my code to this

    var connection = mysql.createConnection({
        localAddress     : '35.160.300.66',
        user     : 'root',
        password : 'root',
        database : 'rootdb',
    });
    

    check mysql node module https://github.com/mysqljs/mysql

    0 讨论(0)
  • 2020-11-30 01:08

    When I tried to install a new ionic app, I got the same error as follows, I tried many sources and found the mistake made in User Environment and System Environment unnecessarily included the PROXY value. I removed the ```user variables http://host:port PROXY

    system Variables http_proxy http://username:password@host:port ```` and now it is working fine without trouble.

    [ERROR] Network connectivity error occurred, are you offline?
    
            If you are behind a firewall and need to configure proxy settings, see: https://ion.link/cli-proxy-docs
    
            Error: getaddrinfo ENOTFOUND host host:80
    
    0 讨论(0)
  • 2020-11-30 01:11

    I was running into the same problem and after some trial and error discovered that my hosts file customisation was causing the problem.

    My localhost DNS was overwritten and because of that a simple ping was failing:

    $ ping http://localhost
    # ping: cannot resolve http://localhost: Unknown host
    

    Once I resolved the configuration of /private/etc/hosts file, pinging localhost successfully worked, and was no longer getting the error that you were seeing:

    # Fatal error: getaddrinfo ENOTFOUND
    
    0 讨论(0)
提交回复
热议问题