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 Organizing Your Code with require

Alex Flores
Alex Flores
7,864 Points

How do I use node.js outside of Team Treehouse workspace?

I'm working on my personal website and I tried using Node.JS in my main.js file, but it doesn't work. Is there something that I need to do to get it to work?

Abraham Juliot
Abraham Juliot
47,353 Points

Hi Alex, I presume you have node.js installed on your computer and you are running it on your localhost or an online server which has node installed, as necessary. If so, what is the code in your main.js file? Can you paste it in a repl.it node environment, save it, and link to it here?

https://repl.it/languages/nodejs

3 Answers

Alex Flores
Alex Flores
7,864 Points

Hey Abraham,

Thanks for taking the time to help me out. I think I figured it out. I just had to do a little reading (node.js documentation)!

Thanks again!

Alex Flores
Alex Flores
7,864 Points

Well for some reason it won't let me pick your answer as the best answer, but it'll let me pick mine?

Abraham Juliot
Abraham Juliot
47,353 Points

Hi Alex, that's alright. I only provided a comment. You found the answer. ;)

Hi guys, can someone please answer the question or post a link? I have the very same question and I have not found an answer in documentation.

My question is: How does one run node.js code on a server?

I don't have any clue where to start (i.e. I don't have node running on my local host or any of that... I need a ground level up explanation). Do I use AWS? What files are saved onto the AWS (which would contain node.js code)? I'm really totally clueless about backend stuff. Please help.

Thanks.

Abraham Juliot
Abraham Juliot
47,353 Points

Hi Tony,

Check out Microsoft Virtual Academy's courses on Node.js (all free). I recommend just going through the Mastering Node.js series:

https://mva.microsoft.com/search/SearchResults.aspx#!q=node.js&lang=1033

Also, check out Learn Node.js: A free interactive course for Node beginners

https://hyperdev.com/help/learn-node-js-free-beginner-course/