electron-builder: builds broken since v26.0.4

Affects Windows & macOS at least. Linux seems unaffected https://github.com/element-hq/element-desktop/actions/runs/13135755860/job/36653217694?pr=624

Seems related to https://github.com/electron-userland/electron-builder/pull/8571

Run yarn build:universal --publish never
yarn run v1.22.22
$ yarn run build:ts && yarn run build:res && electron-builder --universal --publish never
$ tsc
$ tsx scripts/copy-res.ts
  • electron-builder  version=26.0.4 os=23.6.0
  • loaded configuration  file=/Users/runner/work/element-desktop/element-desktop/electron-builder.ts
  • executing @electron/rebuild  electronVersion=34.0.1 arch=x64 buildFromSource=false appDir=./
  • installing native dependencies  arch=x64
  • completed installing native dependencies
  • packaging       platform=darwin arch=x64 electron=34.0.1 appOutDir=dist/mac-universal-x64-temp
  • downloading     url=https://github.com/electron/electron/releases/download/v34.0.1/electron-v34.0.1-darwin-x64.zip size=105 MB parts=6
  • downloaded      url=https://github.com/electron/electron/releases/download/v34.0.1/electron-v34.0.1-darwin-x64.zip duration=2.323s
  ⨯ The "path" argument must be of type string. Received undefined  failedTask=build stackTrace=TypeError: The "path" argument must be of type string. Received undefined
    at Object.normalize (node:path:[12](https://github.com/element-hq/element-desktop/actions/runs/13135755860/job/36650705352?pr=624#step:13:13)05:5)
    at flatten (/Users/runner/work/element-desktop/element-desktop/node_modules/app-builder-lib/src/node-module-collector/nodeModulesCollector.ts:63:49)
    at flatten (/Users/runner/work/element-desktop/element-desktop/node_modules/app-builder-lib/src/node-module-collector/nodeModulesCollector.ts:68:9)
    at YarnNodeModulesCollector.convertToDependencyGraph (/Users/runner/work/element-desktop/element-desktop/node_modules/app-builder-lib/src/node-module-collector/nodeModulesCollector.ts:72:5)
    at YarnNodeModulesCollector.getNodeModules (/Users/runner/work/element-desktop/element-desktop/node_modules/app-builder-lib/src/node-module-collector/nodeModulesCollector.ts:[13](https://github.com/element-hq/element-desktop/actions/runs/13135755860/job/36650705352?pr=624#step:13:14)0:34)
    at computeNodeModuleFileSets (/Users/runner/work/element-desktop/element-desktop/node_modules/app-builder-lib/src/util/appFileCopier.ts:181:[16](https://github.com/element-hq/element-desktop/actions/runs/13135755860/job/36650705352?pr=624#step:13:17))
    at /Users/runner/work/element-desktop/element-desktop/node_modules/app-builder-lib/src/platformPackager.ts:509:34
    at async Promise.all (index 0)
    at AsyncTaskManager.awaitTasks (/Users/runner/work/element-desktop/element-desktop/node_modules/builder-util/src/asyncTaskManager.ts:65:25)
    at MacPackager.doPack (/Users/runner/work/element-desktop/element-desktop/node_modules/app-builder-lib/src/platformPackager.ts:324:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Process completed with exit code 1.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 22 (7 by maintainers)

Most upvoted comments

The requirements to run element-desktop’s hak on Windows are not short unfortunately.

- [Git for Windows](https://git-scm.com/download/win)
- [Node LTS](https://nodejs.org)
- [Python 3](https://www.python.org/downloads/) (if you type 'python' into command prompt it will offer to install it from the windows store)
- [Strawberry Perl](https://strawberryperl.com/)
- [Rustup](https://rustup.rs/)
- [NASM](https://www.nasm.us/)
- [Build Tools for Visual Studio 2019](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019) with the following configuration:
    - On the Workloads tab:
        - Desktop & Mobile -> C++ build tools
    - On the Individual components tab:
        - MSVC VS 2019 C++ build tools
        - Windows 10 SDK (latest version available)
        - C++ CMake tools for Windows
       

Thanks. I have successfully reproduced your issue on Windows and got it running. The issue has been fixed in this https://github.com/electron-userland/electron-builder/pull/8845, and I’ve tested it without any problems.

@mmaietta v26.0.6 looks to fix things, thanks for the ping and thanks for the fix @beyondkmp

https://github.com/element-hq/element-desktop/actions/runs/13189975230?pr=2113

Yeah that’s fine, just means you didn’t include an element web in the element desktop build. That’s done via yarn run fetch, more details in the readme. If it gets that far then it should be fine though

@t3chguy @mmaietta

I resolved the issue with the missing ms package(https://github.com/electron-userland/electron-builder/pull/8851), but after running element, it still throws an error, which doesn’t seem to be related to the package itself.

C:\Users\payne\AppData\Roaming\Element exists: no
C:\Users\payne\AppData\Roaming\Riot exists: no
Couldn't find webapp files in any of:
        C:\Users\payne\Code\element-desktop\dist\win-unpacked\resources\app.asar\webapp.asar
        C:\Users\payne\Code\element-desktop\dist\win-unpacked\resources\webapp.asar
        C:\Users\payne\Code\element-desktop\dist\win-unpacked\resources\app.asar\webapp
        C:\Users\payne\Code\element-desktop\dist\win-unpacked\resources\webapp
(node:45888) UnhandledPromiseRejectionWarning: Error: Failed to find webapp files
    at tryPaths (file:///C:/Users/payne/Code/element-desktop/dist/win-unpacked/resources/app.asar/lib/electron-main.js:105:11)
    at async loadConfig (file:///C:/Users/payne/Code/element-desktop/dist/win-unpacked/resources/app.asar/lib/electron-main.js:131:22)
    at async configureSentry (file:///C:/Users/payne/Code/element-desktop/dist/win-unpacked/resources/app.asar/lib/electron-main.js:176:5)
(Use `Element --trace-warnings ...` to show where the warning was created)
(node:45888) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
App setup failed: exiting Error: Failed to find webapp files
    at tryPaths (file:///C:/Users/payne/Code/element-desktop/dist/win-unpacked/resources/app.asar/lib/electron-main.js:105:11)
    at async loadConfig (file:///C:/Users/payne/Code/element-desktop/dist/win-unpacked/resources/app.asar/lib/electron-main.js:131:22)
    at async configureSentry (file:///C:/Users/payne/Code/element-desktop/dist/win-unpacked/resources/app.asar/lib/electron-main.js:176:5)

@mmaietta thanks for the ping, I have given it a go at https://github.com/element-hq/element-desktop/pull/2113

Unfortunately it now seems successful but results in a broken package.

Image

ms is a transitive dev of Sentry, something like

@sentry/electron -> @sentry/node -> @opentelemetry/instrumentation -> require-in-the-middle -> debug -> ms

So 26.0.3 will have the app-builder & squirrel changes you want prob.

26.0.4 was solely a release with a migration of GOlang app-builder-bin’s node_modules collection logic to a JS-based solution (allowing us to more aptly control the logic, support additional package managers, and remove the workaround needed for pnpm hoisting)

We added quite a few additional tests, as well as copied the entire test suite for yarn berry’s hoist.ts logic (we could have installed the yarn package to leverage the logic, but holy moly that would increase our dependency tree/chain to unnecessarily huge)