So far, all of our JavaScript has run inside a web browser. Node.js lets you run JavaScript on your own computer, in a terminal, which is what we need to write servers. This page walks you through installing it.
Follow the section for your computer (Mac or Windows), then everyone does Check That It Works.
.pkg file and click through the installer with
the default options. It will ask for your Mac's password.
On Windows, we'll all use Git Bash as our terminal (not PowerShell or Command Prompt). It uses the same commands as a Mac, so everything in class will work the same for everyone.
.msi file). Run it and keep the default options,
with one exception: on the screen called Tools for Native Modules,
leave the box unchecked. That box installs a lot of extra tools we don't need and
can take a very long time.
Terminal: Select Default Profile, press
Enter, and choose Git Bash. If Git Bash isn't in the list, restart your computer
and try again.
node -v
npm -v
Each one should print a version number, like v24.11.0 and 11.6.2. Your
numbers might be a little different, and that's fine.
csc336-fall2026 folder (File > Open Folder).
Make a new file in it called hello.js with this one line:
console.log("Hello from Node!");
Save it, then in the terminal type:
node hello.js
If you see Hello from Node! printed in the terminal, you're all set. That was
JavaScript running on your computer, with no browser involved. You can delete
hello.js afterward.
These work the same on a Mac and in Git Bash.
pwd: show which folder the terminal is inls: list the files in this foldercd foldername: go into a folder (cd .. goes back up one)node filename.js: run a JavaScript file