fix(ci): force node-gyp >=12.4.0 so the windows-latest install succeeds - #834
Open
AmaadMartin wants to merge 1 commit into
Open
fix(ci): force node-gyp >=12.4.0 so the windows-latest install succeeds#834AmaadMartin wants to merge 1 commit into
AmaadMartin wants to merge 1 commit into
Conversation
`sqlite3@5.1.7` installs via `prebuild-install -r napi || node-gyp rebuild`.
When no prebuilt binary is available for the runner, the fallback source build
runs the hoisted `node-gyp@8.4.1` that `sqlite3` pulls in as an optional
dependency. That node-gyp maps only Visual Studio majors 15, 16 and 17, so it
rejects the Visual Studio major 18 install present on `windows-latest` and the
Install dependencies step fails before anything is built:
gyp ERR! find VS unknown version "undefined" found at
"C:\Program Files\Microsoft Visual Studio\18\Enterprise"
gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
gyp ERR! node-gyp -v v8.4.1
Add a root `overrides` entry forcing `node-gyp` to `^12.4.0`. 12.4.0 is the
lowest floor that both recognises Visual Studio major 18 (mapping it to 2026 and
selecting toolset v145) and keeps the `engines` range satisfied by the runner
Node. An override rather than a dependency bump because every
`@mikro-orm/sqlite@6.x` release exact-pins `sqlite3: 5.1.7`.
`sqlite3` stays at `5.1.7` and no `@mikro-orm` version moves.
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.
Please ensure you have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
1. Link to an existing issue (if applicable):
windows-latestleg dies in Install dependencies, before any test runs. This change fixes that install failure. It does not fix anything about the MikroORM upgrade itself; it only makes fix(deps): upgrade the @mikro-orm family from v6 to v7 #819 re-runnable.2. Or, if no issue exists, describe the change:
Problem:
sqlite3@5.1.7installs viaprebuild-install -r napi || node-gyp rebuild. Whenprebuild-installcannot fetch a prebuilt binary, the fallback source build runs the hoistednode-gyp@8.4.1thatsqlite3pulls in as an optional dependency. That node-gyp maps only Visual Studio majors 15, 16 and 17, so it rejects the Visual Studio major 18 install now present on thewindows-latestrunner, and Install dependencies fails before anything is built:Because the matrix is fail-fast, the Windows install failure also cancels the macOS and Ubuntu legs, so the whole run reads as red.
Root cause, read from the two packages themselves:
node-gyp@8.4.1find-visualstudio.js:253,257,261handle majors 15, 16 and 17 only. Major 18 falls through andversionYearstaysundefined.node-gyp@12.4.0find-visualstudio.js:392maps major 18 to 2026;:463selects toolsetv145.Accuracy note on the premise. The Windows lane is not red on every PR. It fails only when
prebuild-installcannot fetch a prebuilt binary and the source build actually starts — one run hitNo prebuilt binaries found (target=6 runtime=napi arch=x64 libc= platform=win32)and failed as above, while a run a day later downloaded the prebuilt binary, never invoked node-gyp, and passed. So this is an intermittently-triggered but deterministic failure of the fallback path, not a flake in the usual sense. This change makes that fallback path work instead of being a guaranteed failure.Solution:
Add a root
overridesentry forcingnode-gypto^12.4.0:12.4.0is the lowest floor that both recognises Visual Studio major 18 and keeps theenginesrange (^20.17.0 || >=22.9.0) satisfied by the runner Node.An override rather than a dependency bump, because every
@mikro-orm/sqlite@6.xrelease exact-pinssqlite3: 5.1.7. Overriding node-gyp itself also means the fix is not specific to one native module: it applies equally tobetter-sqlite3, which is what #819 switches to.sqlite3stays at5.1.7and no@mikro-ormversion moves — verified package-by-package against the lockfile, see below.Why the diff shows −553 lines. The deletion count is the point of interest for a reviewer, so to be explicit: it is entirely the
node-gyp@8dependency tree falling out of the lockfile. Nothing is removed from the project's own dependencies. Full delta, computed by comparing the two lockfiles entry by entry:node-gyp8.4.1 → 12.4.0,nopt5.0.0 → 9.0.0,abbrev1.1.1 → 4.0.0@isaacs/fs-minipass,exponential-backoff,proc-log,undici@6.28.0, and nestedtar/minizlib/minipass/chownr/yallist/which/isexecacache@15/ssri@8/make-fetch-happen@9chain,npmlog/gauge/are-we-there-yet,@gar/promisify,@tootallnate/once,socks-proxy-agent@6, and their transitivesagent-baseandhttps-proxy-agentmove fromdevOptionaltodev, because their only optional consumer (the node-gyp 8 tree) is gone. Purely npm bookkeeping, no version movement.Dropping the
@tootallnate/onceandcacache@15/ssri@8chain is a side effect of the override, not a goal of this change.Why 15 of the new lockfile entries carry no
licensefield. They match exactly what npm writes:npm installrequests the abbreviated packument, which omitslicense.mainalready carries entries without it, includingundici, which is one of these.Alternatives rejected.
npm_config_msvs_versionin the workflow. node-gyp 8.4.1 fails to derive aversionYearat all, so there is no value to match against.@mikro-orm/sqlite. Every v6 release exact-pinssqlite3: 5.1.7.better-sqlite3. That PR is blocked by this exact install failure, so it cannot be the fix for it.Testing Plan
Unit Tests:
The two suites that load the native
sqlite3binding, run against a cleannpm ciinstall from this lockfile (confirmednode-gyp@12.4.0,sqlite3@5.1.7resolved innode_modules):npm run buildacross all workspaces also completes clean on this install.Manual End-to-End (E2E) Tests:
Lockfile integrity was verified independently rather than taken on trust:
main'spackage.jsonandpackage-lock.json, injected only theoverridesblock and let npm resolve it againsthttps://registry.npmjs.org/. The result is byte-identical to the lockfile committed here — so this is reproducible npm output, contains no hand edits, and a contributor runningnpm installwill see no churn.npm ciresolves the committed lockfile cleanly (1140 packages), confirmingpackage.jsonandpackage-lock.jsonagree.resolvedURL in the lockfile points atregistry.npmjs.org(1137 of 1137).Checklist
Additional context
If another change adding a root
overridesblock lands around the same time, please merge the two blocks rather than replace one with the other.