fix(arborist): reject uninstall args that carry a version #9930

Merged
github-actions[bot] opened 5:24pm on August 27, 2026 wanted to merge 1 commit into npm/cli release/v11 from
backport/v11/9881

Pull Request Overview

  • Opened on August 27, 2026
  • Status Merged
  • Commit count 1 with first commit August 25, 2026

Total Delta

0 Total Diff Delta

Open Days

Open 17 weekdays

Test Delta

0 Diff Delta in Test Files
Breakdown by Phase

How long has this pull request spent in each phase of its lifecycle?

Fraction of total time Business days Phase
N/A 7.0 days Issue creation to work beginning
 
2.2 days Authoring 1 commit before pull request opened for review
 
0.3 days Awaiting first review
 
0.4 days Revising work with 0 commits in response to 1 review that left 0 comments
 
0.0 days Merge to deploy

Total time for pull request 2.9 business days from first commit authored to deploy

Author avatar

fix(arborist): reject uninstall args that carry a version

Backport of #9881 to release/v11.

Is there an existing issue for this?

  • [x] I have searched the existing issues

This issue exists in the latest npm version

  • [x] I am using the latest npm

This is not just a request to bump a dependency for a CVE

  • [x] This is not solely a request to bump a dependency for a CVE

Current Behavior

Incorrectly attempting to uninstall a package using npm uninstall <name>@<version> neither fails, nor uninstalls:

$ npm uninstall [email protected]

up to date, audited 16 packages in 2s

8 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
$ npm ls
tmp.Uwe8XKve3h@ /tmp/tmp.Uwe8XKve3h
└── [email protected]

Expected Behavior

If an attempt is made to uninstall a package using npm uninstall <name>@<version> either:

  1. the command should fail with a syntax error or similar OR
  2. the <version> should be ignored and the uninstall command should use only the package <name> to uninstall

Steps To Reproduce

cd $(mktemp -d)
npm install vite@8
npm uninstall vite@8
npm ls

Environment

  • npm: 12.0.2
  • Node.js: 26.7.0
  • OS Name: Ubuntu 24.04.4 LTS
  • npm config: ini ; node bin location = /home/mike/n/bin/node ; node version = v26.7.0 ; npm local prefix = /tmp/tmp.Uwe8XKve3h ; npm version = 12.0.2 ; cwd = /tmp/tmp.Uwe8XKve3h ; HOME = /home/mike ; Run `npm config ls -l` to show all defaults.

PR was closed without comments.