[Bug][Windows] Desktop packaging always fails: vswhere: ProgramFiles(x86) is not set (env object loses case-insensitivity)
#8173
lb1192176991-lab
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
pnpm run package:desktop:win:x64:unsignedcannot succeed on any Windows host at0.2.0-rc.1. The toolchain preflight aborts the run in theconfiguration/toolchainstage before anything is built:Visual Studio C++ Build Tools are installed and
vswhere.exeis present at the expected path. The message is a false negative.Root cause
apps/desktop/scripts/desktop-package-environment.mjsrebuilds the environment as a plain object:On Windows,
process.envis a case-insensitive proxy, butObject.entries()only yields the canonicalised uppercase key names. So the rebuilt object containsPROGRAMFILES(X86)and notProgramFiles(x86). Because the new object is a plainObject, the case-insensitivity is gone.Downstream,
desktop-toolchain-preflight.tsdoes an exact-match lookup:undefinedis returned, so the probe reports VS as missing even though it is installed.Instrumenting that exact line confirms it:
Note this is not a shell issue. It reproduces under native
cmd.exeas well as git-bash/MSYS, and injecting the variable withenv "ProgramFiles(x86)=..."does not help, becauseloadDesktopPackageEnvironment()discards the ambient value when it rebuilds the object.Reproduction
Any Windows host with VS Build Tools installed:
Suggested fix
Restore case-insensitive lookup on the returned object for the
win32platform, e.g. wrap it in aProxythat falls back to an uppercase-keyed map:Alternatively, have the preflight read the variable case-insensitively (or reuse
process.envfor platform tooling paths instead of the file-owned release settings object).With the patch above,
--checkpasses and a full unsigned package builds successfully:Environment
0.2.0-rc.1(commit4878cdabd8), Windows 10 x64, Node v24.15.0D:\VSBuildTools, Windows SDK 10.0.26100Note
While packaging I also had to satisfy a separate prerequisite that the template leaves empty — worth documenting for anyone attempting a local unsigned build:
validateDesktopPackageEnvironmentrejects an empty origin (requires an HTTPS origin) even for unsigned / preparation-only builds, and test mode additionally requires a non-emptyallowedAuthOrigins.Happy to verify a fix if a branch is ever published. Thanks for the release — everything else about
0.2.0-rc.1is working well here.All reactions