Vineet Kosaraju Vineet Kosaraju - 8 months ago 106
Node.js Question

Node.js getaddrinfo ENOTFOUND

When using Node.js to try and get the html content of the following web page:

I get the following error:

throw er; // Unhandled 'error' event
Error: getaddrinfo ENOTFOUND
at errnoException (dns.js:37:11)
at Object.onanswer [as oncomplete] (dns.js:124:16)

I did already look up this error on stackoverflow, and realized that this is because node.js cannot find the server from DNS (I think). However, I am not sure why this would be, as my code works perfectly on

Here is my code (practically copied and pasted from a very similar question, except with the host changed):

var http = require("http");

var options = {
host: ''

http.get(options, function (http_res) {
// initialize the container for our data
var data = "";

// this event fires many times, each time collecting another piece of the response
http_res.on("data", function (chunk) {
// append this chunk to our growing `data` var
data += chunk;

// this event fires *one* time, after all the `data` events/chunks have been gathered
http_res.on("end", function () {
// you can use res.send instead of console.log to output via express

Here is the source where I copied and pasted from : How to make web service calls in Expressjs?

I am not using any modules with node.js.

Thanks for reading,



In Node.js HTTP module's documentation:

You can either call http.get('', callback), the URL is then parsed with url.parse(); or call http.get(options, callback), where options is

  host: '',
  path: '/wiki/EteRNA_Dictionary'