Installing Node.js and Setting Up VS Code
Objectives
By the end of this lesson, you should be able to:
- Install Node.js and confirm it’s working from the command line
- Set up VS Code with the extensions most useful for Node.js development
- Explain what npm is and why it comes bundled with Node.js
💡 Why this matters: Every remaining lesson in this course assumes a working Node.js installation and a comfortable editor setup. Getting this right once, at the start, avoids friction in every module that follows.
Installing Node.js
Node.js is installed from nodejs.org. The site offers two main options: LTS (Long-Term Support) and Current. Always choose LTS for real work, it’s the stable, recommended version, “Current” includes newer features but with less stability guarantee.
Download the installer for your operating system (macOS, Windows, or Linux) and run it, accepting the default options is fine for this course.
Verifying the Installation
Open a terminal and run:
node --version
v22.22.3
The exact version number will depend on whichever LTS release is current when you install, that’s expected, any current LTS version works fine for this course. What matters is that a version number prints at all, confirming Node.js is installed and available on your PATH.
Node.js installations also include npm (Node Package Manager) automatically, check it the same way:
npm --version
npm is the tool used to install and manage third-party packages, covered properly in the next module, no separate installation step is needed, it comes bundled with Node.js.
Managing Multiple Node Versions (Optional)
Different projects sometimes need different Node.js versions. Tools like nvm (Node Version Manager) let you install and switch between multiple versions on the same machine. This isn’t required to follow this course, a single current LTS installation is enough, but it’s worth knowing this tool exists once you’re working on multiple real projects side by side.
Setting Up VS Code
VS Code is a free, widely used code editor with strong built-in support for JavaScript and Node.js. After installing it, a few extensions make Node.js development noticeably smoother:
- ESLint, catches common JavaScript mistakes and style issues as you type.
- Prettier, automatically formats code consistently.
- A Node.js debugging setup, VS Code has this built in already, no extension required, it can run and step through a Node.js program directly from the editor.
Install extensions from the Extensions panel (the icon on the left sidebar, or Cmd/Ctrl+Shift+X), searching for each by name.
The Integrated Terminal
VS Code includes a built-in terminal (Ctrl+` on any platform, or Terminal → New Terminal from the menu), meaning every command in this course, including every Node.js program, can be run without leaving the editor. This is the terminal used throughout the rest of this course.
Try It
- Install Node.js (LTS) and confirm both
node --versionandnpm --versionprint a version number. - Install VS Code, then install the ESLint and Prettier extensions.
- Open VS Code’s integrated terminal and run
node --versionfrom inside it, confirming it matches what you saw in your regular terminal.
Recap
- Node.js is installed from nodejs.org, always choose the LTS release for real work.
node --versionandnpm --versionconfirm a working installation, npm comes bundled automatically.- VS Code, with ESLint and Prettier installed, plus its built-in terminal, is the development setup used throughout this course.
Next lesson: writing and running your first real Node.js program.