From abd551ea4bf0708574109f265c7abf8503affa9c Mon Sep 17 00:00:00 2001 From: StefanStojanovic Date: Tue, 7 Mar 2023 11:42:13 +0100 Subject: [PATCH] deps: fix node-gyp find visual studio win arm64 This change cherry-picks a part of node-gyp changes needed to enable the find visual studio script to run on Windows on ARM64. This is needed for running Node.js native test suites in the CI on Windows ARM64 machines. Original commit message: fix: find visual studio arm64 support This enables running find visual studio script on Windows on ARM64 Refs: https://github.com/nodejs/node-gyp/pull/2810 --- deps/npm/node_modules/node-gyp/lib/find-visualstudio.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/deps/npm/node_modules/node-gyp/lib/find-visualstudio.js b/deps/npm/node_modules/node-gyp/lib/find-visualstudio.js index d3815112e65de0..25550ec9b41009 100644 --- a/deps/npm/node_modules/node-gyp/lib/find-visualstudio.js +++ b/deps/npm/node_modules/node-gyp/lib/find-visualstudio.js @@ -126,7 +126,11 @@ VisualStudioFinder.prototype = { // Invoke the PowerShell script to get information about Visual Studio 2017 // or newer installations findVisualStudio2017OrNewer: function findVisualStudio2017OrNewer (cb) { - var ps = path.join(process.env.SystemRoot, 'System32', + // SysWOW64 PowerShell is needed on ARM64 because of the COM classes and + // interfaces used by Find-VisualStudio.cs, which are not registered for + // being used from ARM64 processes. + var systemDirectory = process.arch === 'arm64' ? 'SysWOW64' : 'System32' + var ps = path.join(process.env.SystemRoot, systemDirectory, 'WindowsPowerShell', 'v1.0', 'powershell.exe') var csFile = path.join(__dirname, 'Find-VisualStudio.cs') var psArgs = [