I'm new to JavaScript and Node.js and trying to solve the challenge "juggling async" of learnyounode. When the error occured, I've tested my other solutions that use http.get() and all of them throw the exact same error. They worked just fine before, though.
That's a code that worked before:
var http = require('http');
var url = process.argv[2];
function cb_resp(res) {
res.setEncoding('utf-8');
res.on("data", console.log);
res.on("error", console.error);
}
var respo = http.get(url, cb_resp)
The error I keep getting:
$node httpclient.js www.google.de
events.js:72
throw er; // Unhandled 'error' event
^
Error: connect ECONNREFUSED
at errnoException (net.js:904:11)
at Object.afterConnect [as oncomplete] (net.js:895:19)
If it helps, I run a Mac with OS X 10.10.1 and use Brackets as my IDE of choice. I have only 1 terminal open and rebooted my system.
How can I fix it and could somebody please explain what happened, so that I can prevent/solve that problem on my own from now on?