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

Russ Fleharty
seal-mask
.a{fill-rule:evenodd;}techdegree
Russ Fleharty
Python Web Development Techdegree Student 10,815 Points

Node.js need help!

I installed node.js onto my computer and can't access the file that I want to write my program in. It throws out an error saying, ruslans-mbp:~ ruslanfleharty$ node app.js module.js:338 throw err; ^ Error: Cannot find module '/Users/ruslanfleharty/app.js' at Function.Module._resolveFilename (module.js:336:15) at Function.Module._load (module.js:278:25) at Function.Module.runMain (module.js:501:10) at startup (node.js:129:16) at node.js:814:3 the file is located on my desktop in the folder. Do I have to make a path to access it or link to it?

4 Answers

yep, you need to type cd and then whatever folder your project is on, for example lets say my project is in a folder called node in the folder documents you would have to type cd documents then press enter then type cd node and press enter now you can attempt to run your program

It would appear that you have not navigated to the folder than contains the file you wish to execute. You mention that the js file is in your desktop folder, however it would appear that you are in the /Users/ruslanfleharty/ folder. You don't need to 'make a path', you need to make sure that your console is currently in the folder of the file you are trying to execute. I would guess that path would be something more like '/Users/ruslanfleharty/desktop/'.

oh and to get out of your current folder your in in the terminal just type cd