GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix!: run root preinstall before reify by owlstronaut · Pull Request #9267 · npm/cli ConversationBREAKING CHANGE: root `preinstall` now runs before dependencies are installed. SummaryMoves the root Fixes #2660. The bugThe scripts docs have always said Net effect: there is currently no way to run a script at the root before dependencies hit disk. Projects that want to bootstrap auth, generate files consumed during resolution, or gate installs behind a precondition have had no supported hook for five years. The fixSplit the root lifecycle loop in two:
Same split applied to Why now, and why not wait for a lifecycle redesignThis has history:
A comprehensive lifecycle redesign is still the right long-term project and has clearly not happened in five years. Gating the revert on it was reasonable in 2021; but has proven that continuing to gate on it in 2026 just means users keep hitting a bug the docs promise doesn't exist. npm 12 is the right window to ship the scoped revert and decouple it from a future lifecycle rewrite. The code change here is functionally the same as #2713 The differences are: it also patches Closes / supersedesWhen this lands:
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
nishantms
reviewed
Uh oh!
There was an error while loading. Please reload this page. Uh oh!
There was an error while loading. Please reload this page. Uh oh!
There was an error while loading. Please reload this page.
owlstronaut
force-pushed
the
fix/preinstall-ordering-2660
branch
from
4ce2da1 to
586dd87
Compare
wraithgar
reviewed
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: this means any scripts that
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was the biggest reason for the change in the first place. This tripped up more folks than anticipated. It seems obvious in hindsight but it isn't.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 — worth calling out explicitly in the doc since this is the historical footgun. Maybe a sentence at the end of the new paragraph, e.g.:
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
This comment was marked as off-topic.
nishantms
reviewed
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit — the new test covers the success path; should we also lock in the failure contract? Something like: await t.test('a failing preinstall prevents reify', async t => { // mock '@npmcli/run-script' to throw on preinstall // assert npm.exec('install') rejects AND node_modules/abbrev does not exist }) The "no dep on disk before preinstall" guarantee is the real reason for the change — worth a regression test so a future refactor cannot quietly swallow a rejection and still reify.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
nishantms
reviewed
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit — the install.js equivalent mocks this as '@npmcli/run-script': async (opts) => { ... },
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
nishantms
previously approved these changes
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. LGTM, no major blocker, few nits
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsBREAKING CHANGE: root \`preinstall\` now runs before dependencies are installed.
owlstronaut
force-pushed
the
fix/preinstall-ordering-2660
branch
from
586dd87 to
9ac918f
Compare
nishantms
approved these changes
Uh oh!
There was an error while loading. Please reload this page.
This was referenced
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reviewers+1 more reviewerUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
None yet
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. [BUG] Preinstall script runs after installing dependenciesUh oh!
There was an error while loading. Please reload this page. 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. | ||||||||||||||||||||||||||||||||||||
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |