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 Building a Command Line Application Parsing JSON

NAHIMA ABEA
NAHIMA ABEA
5,728 Points

I keep getting this error message, I rewrote it multiple times and thought had to do with not being my username and keep

This is the code

The console Error I keep getting is this:

treehouse:~/workspace$ node app.js
undefined:1
Unauthorized
^

SyntaxError: Unexpected token U in JSON at position 0
at JSON.parse (<anonymous>)
at IncomingMessage.response.on (/home/treehouse/workspace/app.js:23:26)
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)
treehouse:~/workspace$ ^C
treehouse:~/workspace$

Steven Parker
Steven Parker
229,744 Points

More important than the error messages would be showing your actual code.
Take a look at this video about Posting a Question, and also this one about sharing a snapshot of your workspace.

2 Answers

Andre Hammons
Andre Hammons
9,278 Points

If you're trying to view your own json profile, I recommend checking your privacy settings. If it's set to private, accessing the data requires authorization.

Steven Parker
Steven Parker
229,744 Points

As I pointed out in the answer to another recent question, it seems the site has been reoganized since the video.

Instead of something like https://teamtreehouse.com/${username}.json to get user data, try https://teamtreehouse.com/profiles/${username}.json instead.