SIGN IN SIGN UP

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

`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
M
Manzoor Wani committed
a847d28d787f4f864de00ad1fd3344ccac016c62
Parent: 62b0694
Committed by GitHub <noreply@github.com> on 6/18/2026, 8:55:21 PM