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

Alessandro Pepe
seal-mask
.a{fill-rule:evenodd;}techdegree
Alessandro Pepe
Full Stack JavaScript Techdegree Student 24,461 Points

App will not run in the console

Hi, I'm having some issues running this app in the console itself. I'm entering "node weather.js" and a city but nothing happens, the prompt just reappears. I know it's probably a simple mistake, but I've been poring over it and can't quite find it. Help is much appreciated!

https://w.trhou.se/gl7xer7xns

2 Answers

Seth Kroger
Seth Kroger
56,413 Points

It looks like you are trying to use template strings to fill in the placeholders with variable values but are using double-quotes (") which makes them normal strings instead of the backtick (/`). Also near the bottom the request.on('error'...) and the }) closing off the response call back are flipped from how they should be, which means the error handler isn't set until after the error would have occurred. I don't see any syntax error per se in the app.js file but you are a little inconsistent in your formatting, ending statements with a semi-colon or not (I recommend with) and indenting blocks consistently. The latter can be a great help in identifying nesting errors like you have here.

Dave StSomeWhere
Dave StSomeWhere
19,870 Points

Did you check your error message in the console?

FYI - you have a syntax error in app.js and the console error shows the issue.