electron-builder icon indicating copy to clipboard operation
electron-builder copied to clipboard

app-builder.exe (x64) crashes when fetching electron mirror

Open ErickRodrCodes opened this issue 1 year ago • 2 comments

  • Electron-Builder Version: 25.0.5
  • Node Version: 20.17.0
  • Electron Version: 31.3.1
  • Electron Type (current, beta, nightly): current
  • Target: windows

OS: Windows 11 22H2

Problems started today when publishing. Not sure if there was a change when I updated electron builder from 24.13.3 to 25.0.5. Before I was able to build properly files without no inconvenient. It seems that the process to download the mirror fails:

image

The exit code is being produced by the app-builder.exe file

The yaml configuration for my project provided all needed options, and even by removing electronDownload section, the github link still fails.

appId: frontend.electron.app
productName: frontend
directories:
  buildResources: build
files:
  - '!**/*'
  - 'dist/apps/frontend'
  - '!dist/apps/frontend/package.json'
  - 'dist/apps/frontend-electron'
  - 'dist/apps/frontend-electron-icons'
asarUnpack:
  - resources/**
win:
  executableName: frontend
  icon: dist/apps/frontend-electron-icons/icon.ico
  publisherName: 'Erick Rodriguez'
  # Uncomment the following lines if you will include certification
  # information on this file (change accordingly):
  # certificateFile: apps/frontend/electron/resources/certificate/Self.pfx
  # certificatePassword: ""
nsis:
  installerIcon: dist/apps/frontend-electron-icons/setup.ico
  artifactName: frontend-${version}-setup.${ext}
  shortcutName: ${productName}
  uninstallDisplayName: ${productName}
  createDesktopShortcut: always
  include: C:\git-projects\ErickRodrCodes\medical-equipment-record\apps\frontend\electron\install.nsh
mac:
  entitlementsInherit: dist/apps/frontend-entitlements/entitlements.mac.plist
  icon: dist/apps/frontend-electron-icons/icon.icns
  extendInfo:
    - NSCameraUsageDescription: Application requests access to the device's camera.
    - NSMicrophoneUsageDescription: Application requests access to the device's microphone.
    - NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder.
    - NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder.
  notarize: false
dmg:
  artifactName: frontend-${version}.${ext}
linux:
  icon: dist/apps/frontend-electron-icons/icon.ico
  target:
    - AppImage
    - snap
    - deb
  maintainer: electronjs.org
  category: Utility
appImage:
  artifactName: frontend-${version}.${ext}
npmRebuild: false
publish:
  provider: generic
  url: https://example.com/auto-updates
electronDownload:
  mirror: https://npmmirror.com/mirrors/electron/

ErickRodrCodes avatar Sep 22 '24 00:09 ErickRodrCodes

It turns out that By reading a previous post from similar error, I find out that, if you somehow you can't download the respective zip of your electron distribution, you can always palace it in your AppData/Local/Electron/Cache folder:

image

that said, I was able to build properly my application:

image

So if you ever get this when downloading the required electron version:

proxyconnect tcp: dial tcp :0: connectex: The requested address is not valid in its context.

Keep in mind that placing the requested version in the cache folder of Electron might help you to get out of problems.

Not ideal, but It would be interesting to leave this topic open as a way to discover what causes app-builder.exe to behave like that.

ErickRodrCodes avatar Sep 22 '24 01:09 ErickRodrCodes

@ErickRodrCodes I'll take a deeper look at this, but that logic is deep in another dependency and this looks to be the only change that relates to the logic change for electron mirrors in that package https://github.com/develar/app-builder/pull/106/files

As a workaround for your current solution of copy-pasting the asset into AppData/Local/Electron/Cache folder, you can alternatively provide a path to a cache folder via electronDist, which expects either a string path to a folder containing those electron artifacts or can be a callback function (synchronous currently) https://www.electron.build/app-builder-lib.interface.configuration#electrondist

Related, I just realized I could convert the electronDist to be like the other electron-builder hooks, such that it'd allow passing in a file/module and allow asynchronous processing (in case you'd like to do additional async processing -> downloading assets, renaming files, etc. during the electron staging setup). Created a draft PR if that sounds interesting or usable https://github.com/electron-userland/electron-builder/pull/8525

mmaietta avatar Sep 23 '24 04:09 mmaietta

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Mar 02 '25 00:03 github-actions[bot]

This issue was closed because it has been stalled for 30 days with no activity.

github-actions[bot] avatar Apr 01 '25 00:04 github-actions[bot]

It turns out that By reading a previous post from similar error, I find out that, if you somehow you can't download the respective zip of your electron distribution, you can always palace it in your AppData/Local/Electron/Cache folder:

image

that said, I was able to build properly my application:

image

So if you ever get this when downloading the required electron version:

proxyconnect tcp: dial tcp :0: connectex: The requested address is not valid in its context.

Keep in mind that placing the requested version in the cache folder of Electron might help you to get out of problems.

Not ideal, but It would be interesting to leave this topic open as a way to discover what causes app-builder.exe to behave like that.

Thanks bro. You just saved my life 😭

491239 avatar Apr 28 '25 11:04 491239

https://www.electron.build/app-builder-lib.interface.configuration#electrondist

FYI, this would prevent you from having to manually editing/copy-pasting electron into your Cache folder

mmaietta avatar Apr 28 '25 21:04 mmaietta

https://www.electron.build/app-builder-lib.interface.configuration#electrondist

FYI, this would prevent you from having to manually editing/copy-pasting electron into your Cache folder

I have tried this hook, it's perfectly work for me ! Thank you for your contribution, bro ! 😀

Image

491239 avatar Apr 29 '25 02:04 491239