Node npm¶
- ID
npm- Home page
- Version requirement
>= 11.10
- Cooldown
✓
- Platforms
🅱️ BSD · 🐧 Linux · 🍎 macOS · ⨂ Unix · 🪟 Windows
- Operations
installed·outdated·search·install·upgrade·upgrade_all·remove·cleanup·doctor- purl types
pkg:npm- Brewfile entry
npm, in Brewfile backups- CLI name
npm- Every call
npm --global --no-progress --no-update-notifier --no-fund --no-audit <command>- Issues and PRs
- Source
The Node.js package manager.
mpm drives npm in global mode: every call forces --global so packages land
in the shared prefix instead of the current working directory. Per-scope
targeting and multi-binary discovery (several node versions through nvm) are
tracked in #1725. Command
equivalences with the sibling JS managers are listed in
antfu-collective/ni.
Queries parse npm’s --json output. Mutating operations are marked
privileged so --sudo can escalate writes into a root-owned global prefix,
though escalation stays dormant unless requested.
Note
npm enforces a supply-chain cooldown through its min-release-age
resolver option, refusing to resolve any release younger than the
configured age. The version floor exists for it: min-release-age first
shipped in 11.10.0, and older releases silently ignore the setting.
Caution
A fatal npm error (usually a local node version out of sync) is reported
both on <stderr> and as a JSON blob on <stdout>. The run_cli
override blanks that JSON so the failure surfaces once, through
<stderr>, rather than being parsed as a package listing.
What mpm adds to npm¶
Through mpm, npm gains --exact search, to narrow results to exact names.
Bigger still, mpm reaches across every manager at once: mpm installed and mpm outdated cover npm alongside pnpm, volta, yarn, yarn-berry and any other manager you run in one table, mpm upgrade --all updates them together, and mpm sbom exports the whole machine as one bill of materials.
Every mpm command also gains --dry-run and --plan previews, cross-scheme version comparison and purl identifiers. See manager augmentations for how each one is built.
Your npm commands, in mpm¶
You already know npm: each operation maps one-to-one onto mpm, in an interface shared by every manager.
To… |
With |
With |
|---|---|---|
List what’s installed |
|
|
List outdated packages |
|
|
Search for a package |
|
|
Install a package |
|
|
Upgrade one package |
|
|
Upgrade everything |
|
|
Remove a package |
|
|
Clear caches |
|
|
Run health checks |
|
|
Prefix any command above with --dry-run to simulate the underlying manager calls without touching the system: the safe way to watch what mpm would do before trusting it.
Operations¶
Operation |
Supported |
Notes |
|---|---|---|
|
✓ |
|
|
✓ |
|
|
||
|
✓ |
exact search backfilled by |
|
✓ |
|
|
✓ |
|
|
✓ |
|
|
✓ |
|
|
||
|
✓ |
|
|
✓ |
Selecting and configuring npm¶
Deselect npm for a single run with --no-npm, or persist the choice in your configuration:
[mpm]
npm = false
The arguments and environment variables listed in the box atop this page are forced on every npm call, so runs stay quiet, non-interactive and reproducible: the defaults you would set in CI anyway.
Keep it enabled but tune how mpm drives it with a per-manager override:
[mpm.managers.npm]
timeout = 900
mpm config-template npm prints every overridable attribute as a ready-to-paste block.
Recipes¶
A few jobs you would otherwise script around npm, one mpm command each:
Snapshot and clone a machine:
mpm --npm dump npm.toml, thenmpm restore npm.tomlon the next one.Export a Brewfile entry instead:
mpm --npm dump --brewfile Brewfile.Export a compliance SBOM:
mpm --npm sbom(CycloneDX by default,--spdxfor SPDX).Gate CI on health:
mpm --npm doctorrelays Node npm’s own diagnosis and exits non-zero on trouble.
Privilege escalation¶
mpm runs this manager as the current user and never prepends sudo by default. Flip the policy for its privileged operations with --sudo or the per-manager sudo override.
See privilege escalation for the full policy.
Cooldown¶
mpm natively enforces its release-age cooldown on Node npm, injecting the npm_config_min-release-age environment variable on every call. Point it at a window (mpm --cooldown 7 --npm upgrade --all) to skip anything published in the last 7 days: a guard against a compromised or yanked fresh release landing before anyone notices.
Status: ✅ Enforced (npm ≥ 11.10)
Mechanism:
min-release-ageenvnpm_config_min-release-age(integer days)Reference: npm docs
A cooldown only pays off where a compromised release can be withdrawn while the clock runs, and can only be emulated where the registry dates its releases. From the retraction table:
Registry: npm registry (
pkg:npm)Retraction: Unpublish within 72 h of publishing, then only with no dependents, under 300 weekly downloads and a single owner (policy). Past that, flag only:
npm deprecatewarns on install but does not stop resolutionPublish date: ✅
time, mapping each version to its publication timestamp (packument)
Version probe¶
The version is extracted from the output of npm --version with:
r"(?P<version>\S+)"
Reference traces¶
Raw native outputs captured in the manager source: the reference mpm’s parsers were written against. If you know Node npm well and a transcript below looks wrong, or a newer release changed its output format, report it.
$ npm --global --no-progress --no-update-notifier --no-fund --no-audit --json --depth 0 list
{
"name": "lib",
"dependencies": {
"@eslint/json": {
"version": "0.9.0",
"overridden": false
},
"@mermaid-js/mermaid-cli": {
"version": "10.8.0",
"overridden": false
},
"corepack": {
"version": "0.30.0",
"overridden": false
},
"google-closure-compiler": {
"version": "20240317.0.0",
"overridden": false
},
"npm": {
"version": "10.9.2",
"overridden": false
},
"raven": {
"version": "2.6.4",
"overridden": false
},
"wrangler": {
"version": "3.51.2",
"overridden": false
}
}
}
$ npm --global --no-progress --no-update-notifier --no-fund --no-audit --json outdated
{
"my-linked-package": {
"current": "0.0.0-development",
"wanted": "linked",
"latest": "linked",
"location": "/Users/kev/dev/my-linked-package"
},
"npm": {
"current": "3.10.3",
"wanted": "3.10.5",
"latest": "3.10.5",
"location": "/opt/homebrew/lib/node_modules/npm"
}
}
Feed any of these through mpm and the raw output becomes one uniform table, the same shape for every manager: filter it, project columns, or export it (mpm --npm installed --output json, or csv, toml, yaml), each package carrying a purl and a version comparable across managers.
Changelog¶
7.1.0(2026-07-07)installno longer passes--no-fundand--no-audittwice.
6.4.0(2026-04-27)Add
cleanupoperation.
6.2.1(2026-03-26)Fix crash on
installedwhen no global packages are present. Closes #1603.
5.21.0(2025-05-29)Fix retrieval of installed packages.
5.5.1(2022-07-11)Implements
removeoperation.Use canonical commands for operations.
Reduce output verbosity with
--no-fundand--no-auditoptions.
5.3.0(2022-06-25)Apply global variables to all operations.
3.5.0(2020-09-20)Always fix JSON parsing on error for any npm subcommand.
3.4.2(2020-09-13)Skip parsing of JSON results on error.
3.0.0(2020-03-25)install package@versioninstead ofupdate package.Skip update notifier.
2.5.0(2017-03-01)Bump minimal requirement of
npmto4.0.*.Allow use of
apm,gemandnpmmanagers on Linux.
1.4.0(2016-07-10)Check for linked
npmpackages.
1.2.0(2016-07-08)Add support for both
pip2andpip3, Node’snpm, Atom’sapm, Ruby’sgem.