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 Asynchronous Programming with JavaScript Understanding Promises Create a Promise

Daven Hietala
Daven Hietala
8,040 Points

$ node promises-breakfast.js internal/modules/cjs/loader.js:638 throw err; ^

How do I get the terminal to work inside of VS Code like it does in this video!!!!!!!!!!




I have node.js installed

I downloaded git and made it the default terminal for windows.

I tried running the command prompt as administrator

I definitely have node installed

I watched a couple of you tube videos

I have read through the git documentation

I have read through the VS Code terminal settings documentation

I have asked questions to this community

I am still having trouble getting the console to work like it does in this video.

This is what it says when I try to run "node promises-breakfast.js" inside of the terminal in VS Code.

dell@dell-PC MINGW64 ~/Documents/Coding Projects $ node promises-breakfast.js internal/modules/cjs/loader.js:638 throw err; ^

Error: Cannot find module 'C:\Users\dell\Documents\Coding Projects\promises-breakfast.js' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Function.Module.runMain (internal/modules/cjs/loader.js:831:12) at startup (internal/bootstrap/node.js:283:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

Can somebody please explain to me how to set up the terminal like Guil has his set up in this tutorial?

Thank you in advance.


Rodrigo Novaes
Rodrigo Novaes
9,629 Points

Make sure your are on the right directory.

3 Answers

Heidi Fryzell
.a{fill-rule:evenodd;}techdegree seal-36
Heidi Fryzell
Front End Web Development Treehouse Moderator 25,133 Points

Yes Rodrigo Novaes was correct. Thank you Rodrigo! Make sure you have navigated with the terminal into the directory where the promises-breakfast.js file is located. In the downloaded project files the directory is called. "js".

Jamie Gobeille
.a{fill-rule:evenodd;}techdegree seal-36
Jamie Gobeille
Full Stack JavaScript Techdegree Graduate 19,572 Points

Hello! It is throwing an error because the promises-breakfast.js file is not located in the root directory. The file is located in the js file.

Just write node js/promises-breakfast.js into your command line OR type cd js which will move you from the root directory and into the js file and then type node promises-breakfast.js.

Edgardo Serafin
Edgardo Serafin
Full Stack JavaScript Techdegree Student 11,880 Points

Jamie Gobeille , thank you!

In the video, Guil writes only node promises-breakfast.js so I didn't even think to look at the path of the file to put in js/ before the file name

Daven Hietala
Daven Hietala
8,040 Points

What I ended up doing was listening to this guy..

"Axel Perossa Axel Perossa 13,868 Points Axel Perossa on Sep 15 Sorry, I'm just seeing the messages. Where does it say you need JSHint? Those extensions are helpers, if you like, but they are not needed. You can just write your basic javascript code and it should work anyway, regardless vscode marks it as valid or not (and it should).

I'd advise to uninstall your current setup (npm, node, git, bash, modules, maybe even vscode) and start anew. I see you are using Windows as I am: I'd try installing everything through Chocolatey. It's a command line app that lets you install software, and usually does it all for you. It picks the correct folders, configures things, etc.

Then you could install nodejs and npm writing "choco install nodejs", then vscode with "choco install vscode", git with "choco install git" and so on. Having nodejs correctly installed, and Vscode, you shouldn't need anything else to complete the course.

Learning this stuff is part of becoming a developer though. It's frustratingly convoluted at times, but its needed. Don't see it as wasting time you could spend going along with the course, but an opportunity to learn yet another skillset that you will need. Workspaces makes it easier as a beginner, but it totally spoils you, I agree.

Let me know if you need more help, maybe we can go trough it set by step."

I followed these directions verbatim and have been good to go ever since.