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 Build a Simple Dynamic Site with Node.js Creating a Simple Server in Node.js Preparing & Planning

Jerry Relunia
Jerry Relunia
17,148 Points

Error getting profile in example_profile.js when running 'node example_profile.js' in workspaces

i get "there was an error getting the profile for chalkers. (moved permanently)", is it because its https://teamtreeehouse.com and not 'http://teamtreeehouse.com' ?

Yes. That's exactly why. They moved everything to https and haven't updated the files/videos. I'm having the same issue. Kind of sucks... Unsure of how to proceed...

3 Answers

Cracked it: Go to profile.js and add an "s" to everywhere you see "http".

That is, change line 2 to: var https = require("https");

Change line 17 to: var request = https.get("https://teamtreehouse.com/" + username + ".json", function(response) {

Change line 23 to: profileEmitter.emit("error", new Error("There was an error getting the profile for " + username + ". (" + https.STATUS_CODES[response.statusCode] + ")"));

With that you should be good. I'm back up and running.

michael7williams
michael7williams
9,638 Points

Thanks Tom. Find and replace with Sublime worked.

Jerry Relunia
Jerry Relunia
17,148 Points

Thanks Tom, i see the http.STATUS_CODES will still work i think.

Maria Campbell
Maria Campbell
8,641 Points

I made the changes that Tom suggested (similar to what I did in nodejs-basics), and it did not work. I tried even moving everything into the design folder because my terminal was not recognizing the existence of example_profile.js (I don't use workspaces), and I am getting an error with https:

node example_profile.js ⏎ /Users/mariacam/Development/bitbucket-repos/simple-dynamic-site-nodejs/stage_1_video_3/designs/profile.js:17 var request = https.get("https://teamtreehouse.com/" + username + ".json", function(response) { ^

ReferenceError: https is not defined at new Profile (/Users/mariacam/Development/bitbucket-repos/simple-dynamic-site-nodejs/stage_1_video_3/designs/profile.js:17:19) at Object.<anonymous> (/Users/mariacam/Development/bitbucket-repos/simple-dynamic-site-nodejs/stage_1_video_3/designs/example_profile.js:4:22) at Module._compile (module.js:435:26) at Object.Module._extensions..js (module.js:442:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:311:12) at Function.Module.runMain (module.js:467:10) at startup (node.js:136:18) at node.js:963:3

Maria Campbell
Maria Campbell
8,641 Points

It didn't immediately respond, and I had to finagle with moving files in and out of folder(s), but it finally works as per Tom. Don't know why it didn't initially!