Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Node.js Basics 2017 Handling Errors in Node Handling the Error Event in Node

Getting a different error on local computer.

I'm following along in a git bash terminal on my laptop instead of the workspace. I noticed in the workspace, I get for the expected error:

getaddrinfo ENOTFOUND wwwteamtreehouse.com wwwteamtreehouse.com:443

But when I run the same code in my terminal on my laptop, I get:

Problem with request: connect ECONNREFUSED

Is this just a node configuration thing?

Neil McPartlin
Neil McPartlin
14,662 Points

That does seem strange. My first thought was whether you have the same version of Node installed at both locations. So it's worth typing node -v just to rule this out. When I tried this I realised I have node installed globally on my PC so naturally both terminal variants returned the same answer. I have 6.11.0 installed locally whereas on Treehouse (workspaces), they have 6.11.1 but that difference did not change the error message, both are like your first one. But maybe you have 2 Node installations locally installed and one is a lot older?

While replicating this, I found I already had a file called app.js installed locally, so I gave my test file a unique name. Is there any chance your 2 terminals are not looking at the same app.js file?

1 Answer

So I searched for a possible answer to your question while trying to figure out my own problem (the errors aren't even showing up for me and I'm following along on a local workspace running Linux bash, too). I found this link on Stack Overflow: Occassional ECONNREFUSED errors . Top answer was this:

ECONNREFUSED means you tried to make a connection to another machine but your connection was refused - either no one was listening or a firewall blocked you. I have seen this using http, but I think it could also happen using straight sockets.

So it could be either of those two scenarios?