p:: Node
f:: yarn, pnpm
- npm
- Default package manager bundled with Node
- Also the name of the public registry at npmjs.com
Common Commands
| Command | Description |
|---|
npm install | Install all dependencies from package.json |
npm install <pkg> | Install a package and save to dependencies |
npm install -D <pkg> | Install as devDependency |
npm run <script> | Run a script defined in package.json |
npm update | Update packages to latest compatible versions |
npm publish | Publish a package to the registry |
Alternatives
- yarn — faster installs, workspaces
- pnpm — disk-efficient, hard links
- Bun — all-in-one runtime with built-in package manager
Version Management
- nvm — switch Node (and npm) versions
- volta — pin Node/npm versions per project