Complete guide to npm, the default package manager for Node.js, covering the npm registry, CLI fundamentals, global vs local packages, and configuration.
Verified: 2026-09-30
Tested on:npm 10.x, node 22.x
Platforms:
linuxmacoswindows
#npm#nodejs#package-manager#javascript
npm (Node Package Manager) is the default package manager bundled with Node.js. It consists of:
The npm Registry: A public database containing over 3 million open-source JavaScript packages.
The npm CLI: A command-line client used to install, publish, update, and manage dependencies.
The npm Website: The web interface for browsing documentation, versions, and maintainers.
Global packages are installed system-wide in your user home directory or system path, making CLI binaries accessible anywhere:
npm install -g pm2
[!TIP]
Use npx instead of installing CLI utilities globally. npx <package> downloads and executes the latest binary ephemerally without polluting your system path: