Skip to content

Commit 72dec93

Browse files
authored
fix(ci): install VS 2022 Build Tools for Node 22 on windows-arm64 (#222)
## Problem `windows-arm64 (22)` fails every time ([example](https://github.com/yao-pkg/pkg-fetch/actions/runs/39743037572/job/119704702722)): ``` Looking for Visual Studio 2022 Failed to find a suitable Visual Studio installation. ``` The `windows-11-arm` label now uses the `windows-11-vs2026-arm64` image, which has only VS 2026 (actions/runner-images#14602, finished Sept 30). Node 22's `vcbuild.bat` only looks for VS 2022 (`[17.6,18.0)`). Node 24 and 26 also look for VS 2026, so they still pass. No hosted arm64 Windows image with VS 2022 is left. ## Fix For the arm64 + Node 22 job only, install VS 2022 Build Tools with the VC tools workload, ARM64 compilers and ARM64 ATL. Node 22's vswhere query uses `-products *`, so it finds a Build Tools install. Considered instead: - **Patch `vcbuild.bat` to accept VS 2026** (port of nodejs/node#60727, ~30 lines). Node 22's gyp already supports VS 2026, so this would be enough to find the compiler. But upstream keeps v22 on VS 2022 on purpose (the VS 2026 tooling/doc PRs are `dont-land-on-v22.x`), so Node 22 is never built with MSVC 18 and its older V8 may not compile with it. It would also add a hunk to carry into every new v22 patch, and our binary would use a different compiler than the official release. - **Switch to a different runner label.** None exists: the VS 2022 arm64 image is gone. ## Test Windows workflow run on this branch: https://github.com/yao-pkg/pkg-fetch/actions/runs/39779279895
1 parent 5f4a2d5 commit 72dec93

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎.github/workflows/build-windows.yml‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ jobs:
3737

3838
- run: choco install nasm
3939

40+
# windows-11-arm ships only VS 2026, but Node 22's vcbuild.bat only detects VS 2022
41+
- name: Install VS 2022 Build Tools
42+
if: matrix.arch.name == 'arm64' && matrix.target-node == 22
43+
run: |
44+
Invoke-WebRequest https://aka.ms/vs/17/release/vs_buildtools.exe -OutFile vs_buildtools.exe
45+
$p = Start-Process -Wait -PassThru vs_buildtools.exe -ArgumentList '--quiet', '--wait', '--norestart', '--nocache', '--add', 'Microsoft.VisualStudio.Workload.VCTools', '--includeRecommended', '--add', 'Microsoft.VisualStudio.Component.VC.Tools.ARM64', '--add', 'Microsoft.VisualStudio.Component.VC.ATL.ARM64'
46+
if ($p.ExitCode -ne 0 -and $p.ExitCode -ne 3010) { exit $p.ExitCode }
47+
4048
- run: yarn start --node-range node${{ matrix.target-node }} --arch ${{ matrix.arch.name }} --output dist
4149

4250
- name: Check if binary is compiled, skip if download only

0 commit comments

Comments
 (0)