-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: workaround for missing COM class on Windows 11 arm64 #2477
Conversation
There's a missing COM class for Visual Studio in Windows 11 arm64, which breaks node-gyp builds when using native arm64 NodeJS. Using x86 works around this and correctly outputs the requested JSON. Issue reported to Microsoft as well: https://developercommunity.visualstudio.com/t/Class-177F0C4A-1CD3-4DE7-A32C-71DBBB9FA3/1491726
Just for the record: using
returns [
{
"instanceId": "a7b0332e",
"installDate": "2021-08-01T14:37:50Z",
"installationName": "VisualStudio/16.10.4+31515.178",
"installationPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools",
"installationVersion": "16.10.31515.178",
"productId": "Microsoft.VisualStudio.Product.BuildTools",
"productPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\Common7\\Tools\\LaunchDevCmd.bat",
"state": 4294967295,
"isComplete": true,
"isLaunchable": true,
"isPrerelease": false,
"isRebootRequired": false,
"displayName": "Visual Studio Build Tools 2019",
"description": "The Visual Studio Build Tools allows you to build native and managed MSBuild-based applications without requiring the Visual Studio IDE. There are options to install the Visual C++ compilers and libraries, MFC, ATL, and C++/CLI support.",
"channelId": "VisualStudio.16.Release",
"channelUri": "https://aka.ms/vs/16/release/channel",
"enginePath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\resources\\app\\ServiceHub\\Services\\Microsoft.VisualStudio.Setup.Service",
"releaseNotes": "https://docs.microsoft.com/en-us/visualstudio/releases/2019/release-notes-v16.10#16.10.4",
"thirdPartyNotices": "https://go.microsoft.com/fwlink/?LinkId=660909",
"updateDate": "2021-08-01T14:37:50.9384817Z",
"catalog": {
"buildBranch": "d16.10",
"buildVersion": "16.10.31515.178",
"id": "VisualStudio/16.10.4+31515.178",
"localBuild": "build-lab",
"manifestName": "VisualStudio",
"manifestType": "installer",
"productDisplayVersion": "16.10.4",
"productLine": "Dev16",
"productLineVersion": "2019",
"productMilestone": "RTW",
"productMilestoneIsPreRelease": "False",
"productName": "Visual Studio",
"productPatchVersion": "4",
"productPreReleaseMilestoneSuffix": "1.0",
"productSemanticVersion": "16.10.4+31515.178",
"requiredEngineVersion": "2.10.2174.31177"
},
"properties": {
"campaignId": "",
"channelManifestId": "VisualStudio.16.Release/16.10.4+31515.178",
"nickname": "",
"setupEngineFilePath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\setup.exe"
}
}
] It can even return the full path to the MSBuild executable:
The current I see that this was considered already back in 2019, but then the comment was:
... it can now by doing I'm happy to create a PR for moving over to |
This PR is no longer necessary. The issue occurs when users of Windows ARM64 upgrade from Windows 10 to Windows 11 - in Windows 10, those users can only run x86 and ARM64 binaries, but in Windows 11, x64 emulation was added as well. This requires a full uninstallation, cleanup and reinstall of Visual Studio, after which the x64 class is also registered correctly. 👍🏼 More details here: https://developercommunity.visualstudio.com/t/Class-177F0C4A-1CD3-4DE7-A32C-71DBBB9FA3/1491726#T-N1499903-N1503191 |
Checklist
npm install && npm test
passesDescription of change
After upgrading to Windows 11,
node-gyp
builds started to fail on my ARM64 device with the following error:So I ran the following command:
After some investigation it turned out that the following is the causing this issue:
177F0C4A-1CD3-4DE7-A32C-71DBBB9FA36D
is only registered in x86 by the Visual Studio installer.A workaround is to call the script above from x86 PowerShell (
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe
). This works correctly and outputs the JSON. While this works standalone, this doesn't work whennode-gyp
is invoked by arm64 NodeJS from a x86 shell. The arm64 NodeJS will still trigger the x64 PowerShell and WOW Redirection doesn't work in this scenario.I've reported this issue to Microsoft and they're currently investigating it. In the meantime, I'd like to introduce a workaround for Windows arm64 to use x86 PowerShell. That's exactly what this PR does. This works on all supported versions of Windows 10 arm64 and Windows 11.