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

John Lukacs
John Lukacs
26,806 Points

profile.js:4 Uncaught ReferenceError: require is not defined at profile.js:4 I am still getting a error

This is what it says in the console profile.js:4 Uncaught ReferenceError: require is not defined at profile.js:4 this is the line of code I have done everything that was asked why is this not working for me

var http = require("http");

4 Answers

John Lukacs
John Lukacs
26,806 Points

Why does this Node.js course not work when you do this out of workspaces and on your computer. I don't understand; why teach something that only works in workspaces

John Lukacs
John Lukacs
26,806 Points

I get the error require is not defined. I thought I made the variable http so why is it not defined

David Olson
David Olson
8,690 Points

Hey John, Try posting all your code? Also if you are not using workspaces are you sure you have installed node correctly? at a command line type node -v to see what version you have. If you dont, here are the guides below.

http://blog.teamtreehouse.com/install-node-js-npm-linux http://blog.teamtreehouse.com/install-node-js-npm-mac http://blog.teamtreehouse.com/install-node-js-npm-windows

Ryan Wittrup
Ryan Wittrup
9,156 Points

Hi John - not sure if you're still stuck on this or found a fix.

Would you be able to post your full code and what editor you're using?

That error would typically occur if implemented on the browser side, since there is no "require" method available to the browser, only server side.