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 Create a Command Line Weather Application Retrieving Data - Solution

han voon wong
han voon wong
11,650 Points

why i got this message?

treehouse:~/workspace$ node app.js london
https://api.openweathermap.org/data/2.5/weather?APPID=%3C8950966992afdb8793201f20056d001f%3E&units=imperial&q=london%2Cus
/home/treehouse/workspace/weather.js:7
const message = Current temperature in ${weather.name} is ${weather.main.temp}F;
^

TypeError: Cannot read property 'temp' of undefined
at printWeather (/home/treehouse/workspace/weather.js:7:77)
at IncomingMessage.response.on (/home/treehouse/workspace/weather.js:41:13)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:139:11)
at process._tickCallback (internal/process/next_tick.js:181:9)

1 Answer

Blake Larson
Blake Larson
13,014 Points

Invalid API key. It means you are not getting anything back from your api call. Just an error object.