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 trialmatt duBurg
5,712 PointsNode.js course - getting same error when using template literal username
"undefined:1 <html><body>You are being <a href="https://teamtreehouse.com/home">redirected</a>.</body></html> SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse (<anonymous>) at IncomingMessage.<anonymous> ((removed)/profileSearch/app.js:24:40) at IncomingMessage.emit (node:events:539:35) at endReadableNT (node:internal/streams/readable:1344:12) at process.processTicksAndRejections (node:internal/process/task_queues:82:21)"
I get this error any time i try to run the app and I cant find any resources to help me. when the request was previously not a template literal I was not having this issue, even though the issue appears to be the json that the program is expecting. Has anyone experienced anything like this?
1 Answer
Mark Sebeck
Treehouse Moderator 38,105 PointsHi Matt. Looks like you forgot to pass in a username. When I run your code with
getProfile("marksebeck");
it runs fine
matt duBurg
5,712 Pointsmatt duBurg
5,712 Points(code posted here)