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

Trouble with node.js

Hello, I have finished node.js and I was trying to play around with it but I couldn't understand one thing.

The teacher showed us how you can use it on the Treehouse workspace, I know how to run a JavaScript file through CMD but what I can't understand is how are we going to run the node.js code from my website for example? I mean how can I upload it and run it ... uhhh I googled it but I can't find how.

Thanks

1 Answer

Steven Parker
Steven Parker
231,269 Points

You run node in the workspace just as you would on your own machine.

For example, if you create a file named mynodeprogram.js, then in the console of your server, you would enter the command:

node mynodeprogram.cs

Or if your hosting provides a "startup script" you might put that line there. You might need to contact the technical support of your hosting company for specific instructions if they provide node access in a different way.

Thanks Steven