npm is the default package manager for Node.js and the world's largest software registry with over 2 million packages. It handles installing dependencies, running scripts, and publishing packages. Every JavaScript project uses npm (or alternatives like pnpm and yarn).

How npm Works

npm install react adds React to your project and records it in package.json. npm run build executes the build script. npm publish shares your package with the world. The npm registry hosts everything from React to tiny utility functions.

Key Concepts

  • package.json — The manifest file listing your project's dependencies, scripts, and metadata
  • node_modules — Directory where npm installs packages — can be enormous but is gitignored and regenerated from package.json
  • Semantic Versioning — Version numbers like 2.1.3: major.minor.patch — breaking.feature.bugfix

Learn npm — Top Videos

npm Educators

Frequently Asked Questions

npm vs pnpm vs yarn?

npm is the default and requires no extra installation. pnpm is faster and more disk-efficient. yarn (Berry) has Plug'n'Play for zero node_modules. Use pnpm for monorepos and speed; npm for simplicity.

What is npx?

npx runs packages without installing them globally. npx create-react-app my-app downloads and runs the tool once. It keeps your system clean and always uses the latest version.

Want a structured learning path?

Plan a npm Lesson →