Cannot find Windows Build Tools

Hello! We are trying to build our Electron app using CircleCI.

When we run electron-builder --win, the build fails with the following error:

    gyp ERR! find VS 
    gyp ERR! find VS msvs_version was set from command line or npm config
    gyp ERR! find VS - looking for Visual Studio version 2017
    gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
    gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer
    gyp ERR! find VS looking for Visual Studio 2015
    gyp ERR! find VS - found in "C:\Program Files (x86)\Microsoft Visual Studio 14.0"
    gyp ERR! find VS - could not find MSBuild in registry for this version
    gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
    gyp ERR! find VS 
    gyp ERR! find VS valid versions for msvs_version:
    gyp ERR! find VS 
    gyp ERR! find VS **************************************************************
    gyp ERR! find VS You need to install the latest version of Visual Studio
    gyp ERR! find VS including the "Desktop development with C++" workload.
    gyp ERR! find VS For more information consult the documentation at:
    gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
    gyp ERR! find VS **************************************************************
    gyp ERR! find VS 
    gyp ERR! configure error 
    gyp ERR! stack Error: Could not find any Visual Studio installation to use

Environment

    machine:
      image: 'windows-server-2019-vs2019:stable'
      resource_class: windows.large
      shell: bash.exe
    steps:
      - checkout
      - install-windows-electron-deps
      - install-electron-modules
      - build-windows
install-windows-electron-deps:
    steps:      
      - run:
          name: 'Install Node Gyp for better-sqlite3'
          command: npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe"
          no_output_timeout: 15m
      - run:
          name: 'Install Node Gyp for better-sqlite3'
          command: npm config set msvs_version 2017
          no_output_timeout: 15m
      - run:
          name: 'Install Node Gyp for better-sqlite3'
          command: npm install --prefix=$HOME/.local --global node-gyp@latest
          no_output_timeout: 15m
install-electron-modules:
    steps:
      - install-all-modules:
          cache-key: electron
      - install-modules:
          cache-key: electron
          app-dir: '~/repo/client/electron_build'
build-windows:
    steps:
      - run:
          name: Generate Builds
          command: bash scripts/deploy_windows_electron.sh

Application

"electron": "^19.0.2"
"electron-builder": "^23.0.3"

The thing is that I look it up myself, the build tools are there ("C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\")

Things I’ve tried so far:

  • npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe"
  • export VCINSTALLDIR="C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\\"
  • npm config set msvs_version=2019 --global
  • npm config set python C:\Python27\python.exe --global
  • npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe" –-global

And I’ve tried installing windows-build-tools@4.0.0 and the LTS version, but it just hangs and never finishes :sob:

We are a bit desperate at this point, any advice?

Hello

Would it be possible to raise a support ticket with our team we will be happy to work with you on this as it will take a bit of time to work out the underlying issue. Please see the link below where you can raise a support ticket with our team.

https://support.circleci.com/hc/en-us

It may also be worth looking into the Windows Orb linked below.

I look forward to hearing from you.

Kind Regards
Owen Oliver