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 (2014) Building a Command Line Application Making a GET Request with http

Owace A
Owace A
777 Points

node app.js does not execute (no errors)

anyone else facing this issue? Theres no syntax errors or anything of the sort.

when i execute node app.js nothing happens except a new command line coming up

William Li
William Li
Courses Plus Student 26,868 Points

can you post your code? It's impossible to tell what goes wrong without seeing the actual code.

Owace A
Owace A
777 Points

Yes, of course. Here is the code:

var http = require("http"); var userName = "owacea";

function printMessage(userName, badgeCount, points) { var message = userName + " has " + badgeCount + " total badge(s) and " + points + "points in JavaScript"; console.log(message); }

var req = http.get("http://teamtreehouse.com/" + userName + ".json", function(resp){ console.dir(resp); });

this works perfectly fine on my local, just not in the treehouse workspace.

So this is not really an issue for me now. This prompted me to get setup locally so I can just work from there going forward.

4 Answers

Did you save your app.js file before you executed it in the console?

Yin Jie Soon
Yin Jie Soon
13,382 Points

I think pressing command S or control S and then executing it is a good idea. It worked for me...

Yin Jie Soon
Yin Jie Soon
13,382 Points

I think pressing command S or control S and then executing it is a good idea. It worked for me...

Owace A
Owace A
777 Points

it wasnt saved.....oops! new to Mac so I kept pressing control + s instead of cmd + s.