Skip to content

Commit 570e135

Browse files
committed
fix: detect real OS arch on Windows-on-ARM
PROCESSOR_ARCHITECTURE reports the current process's arch, not the OS's. On ARM64 Windows, a PowerShell running under x64 emulation would report AMD64, causing start-local-agent.ps1 to download the x64 Node.js build even though an arm64 build is available. Fall back to PROCESSOR_ARCHITEW6432, which holds the native OS arch when the process itself is emulated.
1 parent cda73fe commit 570e135

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

scripts/dev/start-local-agent.ps1

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,16 @@ function Install-NodeLocal {
8888
Write-Host "This does NOT modify your system environment. Delete runtime\node\ to remove it."
8989
Write-Host ""
9090

91+
# PROCESSOR_ARCHITECTURE reports the current process's arch, not the OS.
92+
# On Windows-on-ARM, a PowerShell running under x64 emulation reports AMD64
93+
# here, so also check PROCESSOR_ARCHITEW6432 which holds the native OS arch
94+
# when the process is emulated.
95+
$procArch = $env:PROCESSOR_ARCHITECTURE
96+
$nativeArch = $env:PROCESSOR_ARCHITEW6432
97+
$osArch = if ($nativeArch) { $nativeArch } else { $procArch }
98+
9199
$arch = if ([Environment]::Is64BitOperatingSystem) {
92-
if ($env:PROCESSOR_ARCHITECTURE -eq "ARM64") { "arm64" } else { "x64" }
100+
if ($osArch -eq "ARM64") { "arm64" } else { "x64" }
93101
} else { "x86" }
94102

95103
$nodeVersion = "v22.16.0"

0 commit comments

Comments
 (0)