npm -v (and node -v). If you see version numbers, both are installed. If not, download Node.js from nodejs.org — npm comes with it.Guide
A few one-time steps to install Node.js (which includes npm) and connect it to VS Code.
Remember: npm ships inside Node.js, so you only install one thing. Go to nodejs.org and download the LTS version — "Long-Term Support", the stable build recommended for most people. Pick your operating system:
brew install node also works.nvm (see the tip below).Open a terminal and ask each tool for its version number:
Verify the install
$ node -v
$ npm -v Ctrl+` (the backtick key, above Tab) to open the built-in terminalYou should see version numbers like 'v22.12.0' and '10.9.0'. If you do, both Node and npm are installed.
Projects can require a minimum Node version. This website's package.json declares:
"engines": {
"node": ">=22.12.0"
}
That line means "you need Node 22.12.0 or newer to work on this project". If your
node -v is older, install a newer Node. npm will warn you when your
version doesn't satisfy engines, which is a common first stumbling block.
Tip — switch versions easily: different projects sometimes need different Node versions. A version manager (nvm on Mac/Linux, nvm-windows on Windows) lets you install several and switch with one command — far less painful than reinstalling Node.
VS Code is a free, popular
code editor with everything you need built in. The key thing for npm is its
integrated terminal — a command line that lives right inside the editor, so
you don't switch windows. Open it with Ctrl+` (or menu
Terminal → New Terminal).
npm commands act on the folder you're currently in — specifically, the folder that
contains package.json. This is the single most common beginner mix-up: running a
command in the wrong directory. When you open a project folder in VS Code, its built-in
terminal automatically starts in the right place.
Confirm you're in the right folder
$ ls # Mac/Linux: list files
$ dir # Windows: list files Ctrl+`) — it opens in that folderpackage.json in the file listIf you see package.json listed, you're in the right place to run npm commands.
That's the entire setup. From here on, the chapters are about using npm.
Up next: open up package.json — the file that defines your whole project — and understand every field in it.
FAQ
npm -v (and node -v). If you see version numbers, both are installed. If not, download Node.js from nodejs.org — npm comes with it.node and npm at once.package.json sets "engines": { "node": ">=22.12.0" }, so use Node 22.12 or newer for it.package.json. In VS Code, open the built-in terminal (Ctrl + backtick) and it already starts in that folder.