Skip to content

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

Open
lazerg wants to merge 3 commits into
npm:latestfrom
lazerg:fix/9880-uninstall-version-spec
Open

fix(arborist): reject uninstall args that carry a version#9881
lazerg wants to merge 3 commits into
npm:latestfrom
lazerg:fix/9880-uninstall-version-spec

Conversation

@lazerg

@lazerg lazerg commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

What / Why

npm uninstall vite@8.2.1 neither removes the package nor complains about the argument. The spec goes straight through to Arborist as an rm entry, nothing in the tree is named vite@8.2.1, so the reify finishes with "up to date" and npm ls still shows vite.

npm update already validates its own argument list and throws EUPDATEARGS for anything that is not a bare package name. This applies the same rule to rm, so a version, tag or range now fails with ERMARGS and the message names the command to run instead.

Testing

New case in workspaces/arborist/test/arborist/build-ideal-tree.js, next to the existing rm test and mirroring the update one. It covers an exact version, a tag, ranges, a scoped name carrying a version, and a filesystem path, where the suggestion falls back to <pkg> because there is no name to print. It fails without the change.

References

Fixes #9880

@lazerg
lazerg requested review from a team as code owners August 16, 2026 06:57
@lazerg
lazerg force-pushed the fix/9880-uninstall-version-spec branch from 7699913 to a159748 Compare August 16, 2026 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] npm uninstall <name>@<version> neither executes nor fails

1 participant