### 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 ### Current Behavior Npm [messes up lockfile](https://github.com/jakubmazanec/tools/commit/28fa06fa9a50a390575289537979b1ff6f6031ea#diff-053150b640a7ce75eff69d1a22cae7f0f94ad64ce9a855db544dda0929316519) when updating unrelated dependencies. I suspect this PR is the reason: https://github.com/npm/cli/pull/8431 ### Expected Behavior Npm doesn't remove packages from the lockfile. ### Steps To Reproduce 1. Install newest Npm. 2. Checkout this commit: https://github.com/jakubmazanec/tools/commit/78bacfc4d5babe304e0f539d7140d9d135da8de2 3. Run `npm install` 4. Dependencies are removed, e.g.: https://github.com/jakubmazanec/tools/commit/28fa06fa9a50a390575289537979b1ff6f6031ea#diff-053150b640a7ce75eff69d1a22cae7f0f94ad64ce9a855db544dda0929316519 ### Environment - npm: 11.5.2 - Node.js: 24.6.0 - OS Name: Windows 11