npm

npm

The default package manager for Node.js

Features

  • World's largest software registry with 2M+ packages
  • Workspaces support for monorepo management
  • npm audit for security vulnerability scanning
  • npx for running packages without installation

Pros

  • Ships with Node.js, zero installation needed
  • Largest package registry in any language ecosystem
  • Universal compatibility with all Node.js tools

Cons

  • Slower installs compared to pnpm and Bun
  • node_modules folder can be very large (flat structure)
  • Phantom dependencies from hoisting can cause issues

Overview

npm (Node Package Manager) is the default package manager that ships with Node.js. It provides access to the npm registry, the world’s largest collection of open-source JavaScript packages with over 2 million packages available.

npm handles dependency installation, version management, script running, and package publishing. Its package.json and package-lock.json files have become the universal standard for defining JavaScript project dependencies, used even by alternative package managers.

While newer package managers like pnpm and Bun offer faster performance, npm remains the most widely used option due to its zero-install availability and universal compatibility.

When to Use

npm is a safe default for any JavaScript project. Choose it when you want simplicity and universal compatibility without needing to install additional tools. For performance-critical monorepos or large projects, consider pnpm or Bun.

Getting Started

# npm comes with Node.js - just start using it
npm init -y
npm install react react-dom
npm run dev

Related Technologies