Windows "vcvarsall.bat not found" in CI
A native build tried to initialize the MSVC toolchain via vcvarsall.bat but could not find it. The C++ build tools or the workload that ships vcvarsall.bat is not installed at the expected path.
What this error means
A C/C++ or node-gyp build fails reporting vcvarsall.bat is missing or that the VS Common Tools folder cannot be determined. Deterministic until the C++ workload is present and located.
Error: Cannot find vcvarsall.bat
gyp ERR! find VS - missing any VC++ toolset
gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to useCommon causes
The C++ build tools workload is not installed
vcvarsall.bat ships with the Desktop development with C++ workload. A VS install without it has no vcvarsall.bat.
The script is looked up at a hardcoded, stale path
Hardcoding a VS year/edition path breaks when the runner image upgrades VS; the old folder no longer exists.
How to fix it
Locate vcvarsall.bat with vswhere
Resolve the install dynamically and call the matching vcvarsall.bat.
$vs = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" `
-latest -property installationPath
& "$vs\VC\Auxiliary\Build\vcvarsall.bat" x64Install the C++ workload
Add the native toolset via the VS installer or choco if the image lacks it.
choco install visualstudio2022buildtools -y `
--package-parameters "--add Microsoft.VisualStudio.Workload.VCTools"How to prevent it
- Resolve vcvarsall.bat through vswhere instead of a hardcoded path, and ensure the C++ workload is installed on the image.