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

How do I set up the terminal within VS Code to work like Guil's terminal?

I am new to using VS Code. I installed node.js. When attempting to run "node promises-breakfast.js" I get "C:\Users\dell\Documents\Coding Projects>node promises-breakfast.js 'node' is not recognized as an internal or external command, operable program or batch file." as an answer.

I tried opening node.js as administrator and am still unable to get it to work properly.

What is the proper way to set up the terminal in VS Code to work Guil's did in this tutorial? What steps do I need to complete to set it up?

Thank you in advance

Daven

8 Answers

Begana Choi
PLUS
Begana Choi
Courses Plus Student 13,126 Points

I give up to fix this problem. I just put promise-breakfast js file to the html file in the given project folder, (index.html) <script src="js/promises-breakfast.js"></script> and check the console of this web page. it works the same as terminal.

You would want to select the folder that the file is nested in followed back a backward slash. Therefore, you can write in the console of the workspace as such and it should be fine.

node js/promises-breakfast.js

1 - Install node.js (https://nodejs.org/en/download/)

2 - Ensure the correct file path. (i.e "node js/promises-breakfast.js")

Kevin Nguyen
Kevin Nguyen
2,323 Points

This is stupid he doesn't even show you how to open the terminal.

1 - Install node.js (https://nodejs.org/en/download/)

2 - Ensure the correct file path. (i.e "node js/promises-breakfast.js")

I answered the question in my discussion :]

Where can I find your answer in your discussion please. Iรจm having the same issue I Do not know how to set up the terminal. Thank you

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.

Daven Hietala
Daven Hietala
8,040 Points

When I run "node promises-breakfast.js" Inside of the terminal that comes with VS Code, it returns..

" 'node' is not recognized as an internal or external command, operable program or batch file."

How do I fix that?

u manage to fix it?

Daven Hietala
Daven Hietala
8,040 Points

I have not. Someone mentioned in the other thread to make sure I am in the right directory. I not sure how to do that.

So I had a similar problem (on a Mac) and it took me a while to figure out the solution. The project file is nested in a folder, in a folder, in a folder. I had saved them in the downloads folder. I ended up moving the file promises-breakfast.js to the first folder (asynchronous-programming-with-javascript) and running it like this: "node /Users/MYNAME/Downloads/asynchronous-programming-with-javascript/promises-breakfast.js"

A quick way to ensure you are working in the correct directory is to right click the parent directory of the script you want to run in your file explorer and select "copy path" Then, in the terminal, type cd, a space, and then paste, and Enter/Return. No need to worry about typing a complicated pathname in correctly or navigating through your directory structure. cd will most likely work, but if you're using a flavor of command line shell (terminal) that doesn't support it, just look up the "change directory" command for whatever type of terminal you are using.

As Axel Perossa indicated, most jobs involving programming will expect one to have at least a rudimentary knowledge of how to use a linux/Unix like command line shell. For junior front end developer jobs, I highly doubt anyone will expect you to know how to chain complex commands together, write shell scripts, etc. but a basic knowledge of how to navigate through directory structures, create, rename, move and remove directories and files, install things, etc. will most likely be assumed. It's a little bit like using hunt and peck vs touch typing, with the assumption being that touch typing will be used in a professional setting.

Using the terminal can be intimidating at first, but believe me when I say it is nowhere near as difficult as writing asynchronous JavaScript. If you look in the "Development Tools" section of the courses library, there is an "Introduction to the Terminal" course that will no doubt be helpful.