From a3de44f4caa608ae4a5410833258541eac1e86fe Mon Sep 17 00:00:00 2001 From: Daniel Hanson Date: Thu, 17 Sep 2026 01:37:30 -0500 Subject: [PATCH] fix windows binding --- .github/workflows/ci.yml | 6 ++++++ .github/workflows/release.yml | 4 ++++ CLAUDE.md | 8 ++++++++ 3 files changed, 18 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 37ad103..b1c788d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,6 +44,12 @@ jobs: with: node-version: 22 cache: npm + # windows-latest is Windows Server 2025 with Visual Studio 2026, which the + # node-gyp bundled with the runner's npm (11.5) reports as "unknown + # version undefined" and then gives up on. node-gyp learned VS 18 in + # 12.1.0 and npm 12 bundles 13. + - if: runner.os == 'Windows' + run: npm install -g npm@^12 # npm ci builds the addon through the install script (node-gyp-build) - run: npm ci - run: npm run binding-test diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 88e292f..45356b7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -112,6 +112,10 @@ jobs: with: node-version: 22 cache: npm + # the Windows runner's own npm bundles a node-gyp too old to see the + # Visual Studio 2026 on that image; see ci.yml + - if: runner.os == 'Windows' + run: npm install -g npm@^12 - run: npm ci - run: npm run prebuildify - uses: actions/upload-artifact@v4 diff --git a/CLAUDE.md b/CLAUDE.md index 9acf71b..e11174e 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -100,6 +100,14 @@ Releasing needs three things to line up: The arm64 Linux runner (`ubuntu-24.04-arm`) is free for public repositories only. `tree-sitter build --wasm` runs Emscripten through Docker, which the ubuntu runners provide. +**Windows needs a newer npm than its runner ships.** `windows-latest` is Windows Server 2025 **with Visual +Studio 2026**, and the node-gyp bundled with that image's npm (11.5.0) reads VS 18 as +`unknown version "undefined"` and then reports "Could not find any Visual Studio installation to use", so +`npm ci` fails in the install script. node-gyp learned VS 2026 in 12.1.0 and npm 12 bundles 13, which is why +both jobs that compile the addon there — CI's Node binding and the release's `prebuild` — install `npm@^12` +first. Pinning `windows-2022` instead would work, at the price of testing against a toolchain the image no +longer has. Installs of the published package never meet this: they unpack a prebuild and never run node-gyp. + **The npm package must carry its prebuilds**, or `npm install` runs `node-gyp-build`, finds nothing and compiles, which fails on an image without `python3`, `make` and a compiler — `node:20-slim`, for instance. 0.1.0 was published by hand before the workflow existed and shipped none, which is what that image hit. The