• Faced this issue while trying to build logseq locally.
  • Added the following to npmrc file npm config edit
    • msbuild_path="C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe
      msbuild-path=C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe
      msvs_version=2022
      msvs-version=2022
      
  • Use the developer shell that comes with visual studio.
  • Set DEBUG environment variable to electron-rebuild to get debug logs
  • In this case looking at the source code of node-gyp it was found that it doesn’t support Windows 11 sdk.
  • Installing Windows 10 sdk fixed the issue