Validate npm update lockfiles#1927
Closed
dale-lakes wants to merge 1 commit into
Closed
Conversation
✅ Deploy Preview for viteplus-preview canceled.
|
Author
|
Closing this PR after narrowing the root cause. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
npm install --package-lock-only --ignore-scriptspackage.json,package-lock.json, andnpm-shrinkwrap.jsonwhen npm accepts an update that npm install later rejectsRoot Cause
vp updatedelegates npm projects tonpm update, whilevp installdelegates tonpm install. npm can update the lockfile into a graph thatnpm installlater rejects for peer dependency resolution, sovp update && vp installcan fail aftervp updatereports success.Repro Used
A minimal npm project with:
storybook@^10.3.5@storybook/react-vite@^10.3.5vite-plus@^0.2.0The starting lockfile resolves Storybook
10.3.5and Vite+0.2.0. That starting graph is valid becausestorybook@10.3.5has novite-pluspeer dependency; its peer dependencies are only optionalprettier.Current
npm updatefloats the lockfile to Storybook10.4.6and Vite+0.2.1, but Storybook10.4.6adds optional peervite-plus@^0.1.15, so the subsequent install rejects the lockfile withERESOLVE.This is structural to Storybook's declared peer range, not just a patch float problem: semver
^0.1.15accepts0.1.xonly and does not include0.2.0or0.2.1.With this patch, the same repro makes
vp updateexit1, restores the lockfile to Storybook10.3.5/ Vite+0.2.0, andnpm install --package-lock-only --ignore-scriptssucceeds afterward.Fixes #1926
Validation
cargo fmt --all --checkRUST_MIN_STACK=8388608 cargo test -p vite_installcargo clippy -p vite_install --all-targets --all-features -- --deny warnings -A clippy::byte_char_slices -A clippy::manual_assert_eq -A clippy::needless_return_with_question_mark -A clippy::unused_async_trait_impl -A clippy::useless_borrows_in_formattingtarget/debug/vp update