Setup: VS Code and Node.js

Install VS Code and the LTS version of Node.js on Windows or macOS, check node --version and npm --version in VS Code's terminal, and make the nodejs-course folder every example and exercise goes in.

Novice · Node.js · JavaScript · Updated

By

After this lesson you can

  • Name the tools a Node.js developer uses (VS Code, its terminal, Node.js and npm) and say what each one is for
  • Check that Node.js and npm are installed by running node --version and npm --version in VS Code's terminal

Key takeaways

  • VS Code is a code editor, and its built-in terminal, PowerShell on Windows or zsh on a Mac, is where you run Node.
  • Node.js runs JavaScript on your computer, and npm comes with it, to install packages and run a project's scripts.
  • Install the LTS version of Node.js, the one that gets fixes the longest. Node 26 is the LTS version, and every lesson runs on Node 24 or later.
  • node --version and npm --version print the versions you have. An error such as "not recognized" means the terminal can't find Node yet.
  • Every example and exercise in this course goes in one folder, nodejs-course, in your home folder.

Everything in this course, from your first program to an API online at a link, runs on the same few tools: an editor to write the code, a terminal to run it, and Node.js itself. Setting them up takes about half an hour, once. Windows and macOS are shown side by side: follow the column for your computer.

What you're installing, and why

Tool What it's for Cost
VS Code A code editor: a text editor made for code. It colors your code so it's easier to read, finishes words as you type and underlines some mistakes. Free
VS Code's terminal A terminal is a window where you type a command, press Enter and read the answer. VS Code has one built in: PowerShell on Windows, zsh on a Mac. Comes with VS Code
Node.js Runs JavaScript on your own computer: your programs, your servers and the tests that check your exercises. Free
npm Node's package manager: it installs packages (code other people wrote and shared) and runs a project's scripts, such as npm test. Comes with Node.js

You need a Windows or macOS computer you can install software on, and an internet connection. Git comes in the next lesson.

Install VS Code and Node.js

Windows macOS
How Open the Terminal app (open the Start menu and type terminal), type each command below, then press Enter. Click Yes if Windows asks whether the app may make changes. If you use Homebrew, type each command below in the Terminal app (in Applications > Utilities). If you don't, use the download pages below instead.
VS Code winget install -e --id Microsoft.VisualStudioCode brew install --cask visual-studio-code
Node.js winget install -e --id OpenJS.NodeJS.LTS brew install node

winget is the Windows Package Manager, built into Windows, which installs programs by name. Homebrew does the same job on a Mac, with the command brew. On either computer, the download pages work too:

  • VS Code: code.visualstudio.com. Download the installer, open it and accept the suggested settings. On a Mac, drag Visual Studio Code into Applications.
  • Node.js: nodejs.org. Choose the version marked LTS, download its installer and accept the suggested settings.

LTS means long-term support: the version that gets fixes for the longest, and the one to install for work and for this course. Node.js 26 is the LTS version now. If you already have Node 24, you're set too: every program in this course runs on Node.js 24 or later.

Check Node.js and npm in VS Code's terminal

Close VS Code if it's open, then open it again, so it can find the newly installed Node.js. Open VS Code's own terminal: choose Terminal > New Terminal, or press Ctrl+` (Ctrl and the backtick key, left of the 1 key; it's Ctrl on a Mac too). A panel opens at the bottom of the window. Type each command and press Enter:

node --version
npm --version

--version is read "dash dash version": it asks a program which version it is. If you installed Node.js 26.13.1, the version the course was checked with, you'll see this; a newer number, or one that starts with 24, works as well:

v26.13.1
11.20.0

The first line is Node's version, starting with a v. The second is npm's, which came with it.

Make a folder for the course

Every example and exercise in this course lives in one folder, nodejs-course, in your home folder. In VS Code's terminal, make it:

mkdir ~/nodejs-course

~ (read "tilde") is short for your home folder: C:\Users\<you> on Windows, /Users/<you> on a Mac. mkdir means "make directory", and a directory is another word for a folder. PowerShell prints a few lines about the new folder; zsh prints nothing, which means it worked.

Then choose File > Open Folder, find nodejs-course in your home folder, and open it. If VS Code asks whether you trust the authors of the files, choose Yes: they're your own.

VS Code with the nodejs-course folder open in the Explorer on the left, and the terminal at the bottom showing node --version and npm --version with their answers

If something goes wrong

What you see What it means, and what to do
The term 'node' is not recognized (Windows) or zsh: command not found: node (Mac) The terminal can't find Node.js: it isn't installed yet, or VS Code was open while it installed. Close VS Code completely, open it again and retry. If it still happens, install Node.js again from nodejs.org.
node --version prints a number that starts with v22 or lower That Node.js is older than this course needs. Install the LTS version, then close and reopen VS Code.
winget isn't recognized (Windows) winget comes with Windows' App Installer. Update App Installer from the Microsoft Store, or use the download pages instead.
brew: command not found (Mac) Homebrew isn't installed. Use the download pages instead: you don't need Homebrew for this course.
mkdir says the folder already exists You made it earlier. Open it with File > Open Folder and carry on.

Check yourself

2 questions to try on the lesson page.

So what

You now have the kit professional Node developers use every day: an editor, a terminal and Node.js with npm, plus one folder where all of this course's work will live.

Key terms