Course contentsShow
← JavaScript
Lesson 2484 of 2,72351. Package ManagementFree lesson

Installing Node.js and NPM

How to install Node.js to get NPM, verifying installation, and understanding versioning.

Installing Node.js and NPM

You'll learn how to get Node.js and NPM onto your machine, confirm they're working, and understand what version numbers mean.

Why Install Node.js?

Even though NPM is what you're after for managing packages, Node.js and NPM are bundled together. Think of it like buying a car that comes with floor mats—you get Node.js (the JavaScript runtime) and NPM (the package manager) in one installation.

The Installation Process

  1. Visit nodejs.org and you'll see two download options:

    • LTS (Long Term Support): The stable, recommended version for most users
    • Current: The latest features, but less battle-tested
  2. Download and run the installer for your operating system (Windows, macOS, or Linux)

  3. Follow the installation wizard—the defaults are typically fine

Verifying Installation

Open your terminal or command prompt and run:

node --version
npm --version

You should see version numbers like v20.10.0 for Node and 10.2.3 for NPM.

Understanding Version Numbers

Versions follow semantic versioning (semver): MAJOR.MINOR.PATCH

  • MAJOR: Breaking changes (18 → 20 means incompatible updates)
  • MINOR: New features, backward-compatible (20.9 → 20.10)
  • PATCH: Bug fixes only (20.10.0 → 20.10.1)

The v prefix before Node versions is just convention.

What Just Happened?

You now have two command-line tools: node (runs JavaScript outside browsers) and npm (downloads and manages packages). Both are globally available from any directory in your terminal.

Key Takeaway: Installing Node.js automatically installs NPM; verify both with --version flags, and pay attention to LTS releases for stability.