Skip to content

fix(patch): warn when patch update --to targets an uninstalled version#9575

Merged
owlstronaut merged 1 commit into
npm:latestfrom
manzoorwanijk:fix/patch-update-to-uninstalled-warning
Jun 18, 2026
Merged

fix(patch): warn when patch update --to targets an uninstalled version#9575
owlstronaut merged 1 commit into
npm:latestfrom
manzoorwanijk:fix/patch-update-to-uninstalled-warning

Conversation

@manzoorwanijk

Copy link
Copy Markdown
Contributor

npm patch update <pkg> --to <version> finalizes with allowUnusedPatches: true, so a --to version absent from the tree is recorded silently with only a success line. The next plain npm install then fails with EPATCHUNUSED, far from the command that caused it.

Fix

#resolveNewVersion now warns when the validated --to version is not in the installed tree. It stays silent when the lockfile cannot be read (the power-user upgrade path); the command still succeeds.

References

Fixes #9571
Follow-up to #9439

@manzoorwanijk manzoorwanijk marked this pull request as ready for review June 18, 2026 20:12
@manzoorwanijk manzoorwanijk requested review from a team as code owners June 18, 2026 20:12
@owlstronaut owlstronaut merged commit a847d28 into npm:latest Jun 18, 2026
26 checks passed
@manzoorwanijk manzoorwanijk deleted the fix/patch-update-to-uninstalled-warning branch June 19, 2026 04:51
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 patch update --to <uninstalled-version> leaves the project unbuildable, with no warning

2 participants