Dev Station Technology

Install NPM & Node.js: Your Flawless 5-Step Guide

TL;DR — Install npm and Node.js in Under 5 Minutes

The fastest path: install Node.js from the official website or use a version manager like nvm. npm ships bundled with Node.js, so once Node.js is on your machine, npm is ready to use.

  • macOS / Linux (recommended): curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash then nvm install --lts
  • Windows (recommended): Download the LTS installer from nodejs.org and run it — npm is included automatically.
  • Verify: Run node -v and npm -v in a terminal. Both should return version numbers.

Node.js is a JavaScript runtime built on Chrome’s V8 engine that lets you run JavaScript outside the browser — on servers, in CLIs, and in build tooling. npm (Node Package Manager) is the default package manager for Node.js and the world’s largest software registry, with over 2.1 million published packages.

Because npm is bundled with every official Node.js installer, the practical task is really install Node.js. Once Node.js is installed, npm is available immediately — no separate install required. This guide walks through every supported platform, covers the trade-offs of each method, and ends with verification steps and troubleshooting for the most common issues.

2.1M+
Packages on the npm registry
22.x
Current Node.js LTS major version
48h
Median review time for npm publish
100%
Free for personal and commercial use

Before you install Node.js and npm, make sure your environment meets the following minimum requirements. None of these are strict blockers — a recent OS and a terminal are enough to get started — but matching these baselines avoids the most common install-time failures.

Requirement Minimum Recommended Notes
Operating System Windows 10, macOS 11, Ubuntu 20.04 Latest LTS of your OS 64-bit required for official binaries
RAM 2 GB 8 GB+ Build-from-source needs more
Disk Space 500 MB 2 GB Includes global packages cache
Terminal Access Required PowerShell, Terminal.app, or bash/zsh
Internet Connection Required for install Broadband Needed to fetch the installer and packages
Why a version manager is recommended

Installing Node.js directly from the website gives you a single, system-wide version. A version manager like nvm (Node Version Manager) lets you install and switch between multiple Node.js versions per project — essential when one repo targets Node 18 and another targets Node 22. The version-manager approach also avoids the notorious EACCES permissions errors caused by system-wide npm install -g.


Node.js ships in two release lines: LTS (Long Term Support, even-numbered, production-ready) and Current (latest features, odd or even). For most users and teams, install the LTS line unless you specifically need a feature only available in Current.

macOS

Intel and Apple Silicon

Option A — Official Installer (simplest)

  1. Open nodejs.org/en/download and select macOS Installer (.pkg).
  2. Download the LTS build for your architecture (Apple Silicon = arm64, Intel = x64).
  3. Double-click the .pkg file and follow the installer prompts.
  4. Open Terminal and run node -v to confirm the install.

Option B — nvm (recommended)

  1. Install Xcode Command Line Tools: xcode-select --install
  2. Run the nvm install script:
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
  3. Restart Terminal, then verify: nvm --version
  4. Install the latest LTS: nvm install --lts
  5. Set it as default: nvm alias default 'lts/*'

Option C — Homebrew

  1. Install Homebrew if missing: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  2. Install Node.js: brew install node
  3. Verify: node -v && npm -v

Windows

Windows 10 / 11 (x64, arm64)

Option A — Official Installer (simplest)

  1. Go to nodejs.org/en/download and choose Windows Installer (.msi).
  2. Download the LTS build (x64 for most systems).
  3. Run the .msi file and accept the license.
  4. Leave “Automatically install the necessary tools” checked — this installs Python and build tools needed by some native npm packages.
  5. Open PowerShell and run node -v.

Option B — nvm-windows (recommended)

  1. Download nvm-setup.exe from the nvm-windows releases page.
  2. Run the installer and accept the default install path.
  3. Open a fresh PowerShell window and run: nvm install lts
  4. Activate that version: nvm use lts
  5. Verify: node -v && npm -v

Option C — winget

  1. Open PowerShell and run: winget install OpenJS.NodeJS.LTS
  2. Restart your terminal when the install finishes.
  3. Verify: node -v

Linux

Ubuntu / Debian / Fedora / Arch

Option A — nvm (recommended)

  1. Install build prerequisites (Debian/Ubuntu): sudo apt update && sudo apt install -y curl build-essential
  2. Run the install script: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
  3. Reload your shell: source ~/.bashrc (or ~/.zshrc)
  4. Install the latest LTS: nvm install --lts
  5. Verify: node -v && npm -v

Option B — NodeSource APT repository

  1. Fetch the NodeSource setup script for the LTS line (22.x):
    curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
  2. Install Node.js: sudo apt-get install -y nodejs
  3. Verify both tools: node -v && npm -v

Option C — Distribution package manager

  1. Ubuntu / Debian: sudo apt install -y nodejs npm
  2. Fedora: sudo dnf install -y nodejs npm
  3. Arch: sudo pacman -S nodejs npm
  4. Verify: node -v

Avoid sudo npm install -g

Installing global packages with sudo places files in system-owned directories and routinely produces EACCES errors when you later try to update or remove them. If you installed Node.js through the system package manager, configure npm’s global prefix to a directory inside your home folder instead:

mkdir ~/.npm-global && npm config set prefix '~/.npm-global'
Then add ~/.npm-global/bin to your PATH. Or simply switch to nvm, which sidesteps the issue entirely.


Every official Node.js installer and every nvm install ships npm as part of the bundle. Once Node.js is installed, npm is already on your machine — there is no separate npm download step.

What you may want to do separately is update npm to the latest version, switch to a faster package manager like pnpm or Yarn, or configure npm’s global install directory to avoid permission errors.

Action Command When to use
Check npm version npm -v Confirm what’s installed
Update npm (self-update) npm install -g npm@latest Get newest npm features
Install pnpm npm install -g pnpm Faster installs, saved disk space
Install Yarn npm install -g yarn Alternative registry client
Configure global prefix npm config set prefix '~/.npm-global' Avoid EACCES errors
List global packages npm ls -g --depth=0 Audit what is installed globally
Should you switch to pnpm or Yarn?

For learning and small projects, plain npm is perfectly fine and is the most compatible choice. pnpm is worth adopting once you work in a monorepo or care about install speed and disk usage — it hard-links shared dependencies, so a 200-package install that costs 1.2 GB with npm often costs under 300 MB with pnpm. Yarn (v4) is powerful but adds configuration overhead; pick it if your team already standardizes on it.


After installing, run the three commands below in a fresh terminal window. Each should print a version number with no error. If any command is not found, the install did not complete or your PATH is missing the install directory — see Common Issues below.

  1. Check Node.js: node -v — expect something like v22.11.0.
  2. Check npm: npm -v — expect something like 10.9.0.
  3. Check npx: npx -v — npx runs one-off package binaries without installing them globally.

For a deeper sanity check, create and run a tiny script that prints the Node.js version and a list of installed global packages:

# Create a working directory
mkdir ~/node-hello && cd ~/node-hello

Print versions

node -e "console.log('Node version:', process.version)" npm -v

Initialize a project and install a package

npm init -y npm install lodash node -e "const _ = require('lodash'); console.log(_.chunk([1,2,3,4,5], 2))"

If the final command prints [ [ 1, 2 ], [ 3, 4 ], [ 5 ] ], your Node.js and npm installation is fully working — the runtime can execute code, npm can resolve and install packages from the registry, and modules load correctly.


Most install-time problems fall into one of four buckets: command-not-found PATH issues, permission errors on global installs, SSL/TLS errors behind corporate proxies, and version mismatches between Node.js and a project’s lockfile. The table below maps each symptom to its cause and fix.

Symptom Cause Fix
command not found: node or 'node' is not recognized Install directory not on PATH macOS/Linux: add ~/.nvm/versions/node/... or restart shell. Windows: reinstall with the .msi or add C:\Program Files\nodejs\ to PATH.
EACCES: permission denied on npm install -g Global prefix owned by root Set a user-owned prefix: npm config set prefix '~/.npm-global' and add it to PATH. Better: switch to nvm.
UNABLE_TO_VERIFY_LEAF_SIGNATURE Corporate proxy intercepting HTTPS Set the proxy env vars (HTTPS_PROXY) and/or npm config set strict-ssl false as a last resort.
npm ERR! code ERESOLVE peer dependency conflict Conflicting package versions in package.json Run npm install --legacy-peer-deps or update the offending package to a compatible version.
npm install hangs forever Slow default registry or firewall Switch registry: npm config set registry https://registry.npmmirror.com (mirror) or check your DNS.
nvm: command not found after install Shell rc file not reloaded Run source ~/.bashrc (or ~/.zshrc) or open a new terminal window.
Node version mismatch between projects System-wide install is wrong version Use nvm use <version> per project, or add an .nvmrc file with the target version.
Never use sudo to fix npm permission errors

It is tempting to prepend sudo when npm throws a permission error. Do not. sudo npm install -g puts package files under /usr/local/lib/node_modules owned by root, which makes every subsequent global install, update, and uninstall require sudo as well — and breaks tools like npx that try to write to that directory. The correct fix is always to change the install prefix or switch to nvm.


With Node.js and npm installed and verified, you have the foundation for everything else in the JavaScript ecosystem. The next moves depend on what you want to build:

Build a Backend API

Express, Fastify, or Hono

Spin up a minimal HTTP server in under a minute and learn routing, middleware, and JSON handling. Express is the most documented option; Fastify is faster and has built-in schema validation.

  1. mkdir my-api && cd my-api && npm init -y
  2. npm install express
  3. Create index.js with a single app.get('/health', ...) route.
  4. node index.js — visit http://localhost:3000/health.

Build a Frontend App

Vite + React, Vue, or Svelte

Vite is the de-facto frontend build tool — it uses esbuild for dev-server startup in milliseconds and Rollup for production bundles. Every major framework ships a Vite template.

  1. npm create vite@latest my-app -- --template react
  2. cd my-app && npm install
  3. npm run dev — open the printed localhost URL.
  4. Edit src/App.jsx and watch hot-reload in action.

Automate with CLIs

Build a custom command-line tool

Node.js excels at writing CLIs that shell scripts can’t easily express — JSON parsing, parallel HTTP, and progress bars. Publish your tool to npm and anyone can install it with npm install -g.

  1. npm init -y in a new folder.
  2. Add "bin": { "mycli": "./cli.js" } to package.json.
  3. Write cli.js starting with #!/usr/bin/env node.
  4. npm link to test locally, then npm publish to share.


You now have everything you need: a clear install path for every major operating system, a verification checklist, and a troubleshooting table for the most common failure modes. The only remaining step is to run the commands on your own machine.

Your 60-second action plan
  1. Open a terminal — Terminal.app on macOS, PowerShell on Windows, or your shell of choice on Linux.
  2. Install Node.js via nvm — it is the single decision that prevents the most future pain:
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
    nvm install --lts
  3. Verify both tools are working:
    node -v && npm -v
  4. Initialize your first project and install a package to confirm the registry is reachable:
    mkdir hello-node && cd hello-node && npm init -y && npm install chalk
  5. Pick a direction from Next Steps — backend, frontend, or CLI — and build something small today.

That is the entire install story for Node.js and npm. The runtime is free, the registry is free, and the ecosystem is the largest in the JavaScript world. The fastest way to learn what Node.js can do is to run it — so open a terminal and start now.

Serving Clients Across the US & UK

Dev Station Technology partners with startups, enterprises, and development teams throughout the United States and the United Kingdom. Our Vietnam-based engineering teams offer significant time-zone overlap with both US Eastern/Pacific and UK GMT business hours, ensuring real-time collaboration and faster delivery cycles. We bill in USD and GBP, comply with US regulations (SOC 2, HIPAA) and UK/EU standards (GDPR, ISO 27001), and provide dedicated account management for North American and British clients.

Ask an AI about this

Want an AI assistant to summarize or cite this guide?

Click any link below to open the AI with a pre-filled prompt referencing this article:

Ready to Build Your Field App?

Contact Dev Station Technology to discuss your project requirements and receive a development roadmap within 48 hours.

Get a Quote →

Related articles

Let's Talk