npm Essentials
Version: 10.xPublished: 2026-01-16npm/core
Essential npm commands for Node.js package management.
Project Setup
| Example | Description |
|---|---|
| Initialize project Create package.json with defaults. |
| Install dependencies Install all dependencies from package.json. |
| Clean install Install exact versions from package-lock.json. |
Dependencies
| Example | Description |
|---|---|
| Add package Install and save as dependency. |
| Add dev dependency Install as devDependency. |
| Add global Install package globally. |
| Remove package Remove package and update package.json. |
| List installed Show top-level installed packages. |
Scripts
| Example | Description |
|---|---|
| Run script Execute a script defined in package.json. |
| Run test Run the test script (shorthand). |
| Run start Run the start script (shorthand). |
| List scripts Show all available scripts. |
Updates
| Example | Description |
|---|---|
| Check outdated Show packages with newer versions available. |
| Update packages Update packages within semver range. |
| Update npm Update npm itself to latest version. |
Info & Debug
| Example | Description |
|---|---|
| View package info Show registry information for a package. |
| Check for vulnerabilities Scan dependencies for security issues. |
| Fix vulnerabilities Automatically fix security issues when possible. |
| Why installed Show why a package is installed. |
Publishing
| Example | Description |
|---|---|
| Login Authenticate with npm registry. |
| Publish Publish package to registry. |
| Bump version Increment version (patch/minor/major). |