electron-userland / electron-builder

A complete solution to package and build a ready for distribution Electron app with “auto update” support out of the box
https://www.electron.build
MIT License
13.71k stars 1.74k forks source link

ENOENT: no such file or directory, rename '~\wp-downloader-electron\dist\win-arm64\win-arm64-unpacked\electron.exe' - No electron.exe found - When building for arm64 - Windows #8687

Open sipsuru opened 1 week ago

sipsuru commented 1 week ago
win:
  target:
    - target: nsis
      arch: [x64, ia32, arm64]
    - target: msi
      arch: [x64, ia32, arm64]
    - target: portable
      arch: [x64, ia32, arm64]
    - target: zip
      arch: [x64, ia32, arm64]
    - target: 7z
      arch: [x64, ia32, arm64]
  executableName: wp-downloader-electron
nsis:
  artifactName: ${name}-${version}-setup.${ext}
  shortcutName: ${productName}
  uninstallDisplayName: ${productName}
  createDesktopShortcut: always

npmRebuild: true

publish:
  provider: generic
  url: https://example.com/auto-updates

electronDownload:
  mirror: https://npmmirror.com/mirrors/electron/

Above is a part of my electron-builder.yml. And I'm running on x64 bit Windows.

When I build articatcs

locally (windows-x64) and github hosted runners (windows-latest), building unpack fails, no electron.exe found.

Console log:

> electron-builder --win --arm64

  • electron-builder  version=25.1.8 os=10.0.22631
  • loaded configuration  file=C:\Users\Dragon\Documents\GitHub\wp-downloader-electron\electron-builder.yml
  • writing effective config  file=dist\builder-effective-config.yaml
  • executing @electron/rebuild  electronVersion=33.2.0 arch=arm64 buildFromSource=false appDir=./
  • installing native dependencies  arch=arm64
  • completed installing native dependencies
  • packaging       platform=win32 arch=arm64 electron=33.2.0 appOutDir=dist\win-arm64\win-arm64-unpacked
   ⨯ ENOENT: no such file or directory, rename 'C:\Users\Dragon\Documents\GitHub\wp-downloader-electron\dist\win-arm64\win-arm64-unpacked\electron.exe' -> 'C:\Users\Dragon\Documents\GitHub\wp-downloader-electron\dist\win-arm64\win-arm64-unpacked\wp-downloader-electron.exe'  failedTask=build stackTrace=Error: ENOENT: no such file or directory, rename 'C:\Users\Dragon\Documents\GitHub\wp-downloader-electron\dist\win-arm64\win-arm64-unpacked\electron.exe' -> 'C:\Users\Dragon\Documents\GitHub\wp-downloader-electron\dist\win-arm64\win-arm64-unpacked\wp-downloader-electron.exe'

And indeed there's no electron.exe (or any other renamed executable) in dirst/win-arm64-unpacked dir.

I've tried using nightly/alpha versions of electron and electron-builder -> Didn't work. I also checked if this's a issue with electron-binaries not providing a electron.exe, by any chance -> Electron binaries indeed have electron.exe

So, what I guess it that electron-builder either removes electron.exe or can't copy. As far I know there's nothing to do with electron.exe except for changing the icon and renaming.

[!NOTE] I'm new to electron-builder, so am I doing something wrong when building for arm64 on Windows? I mean, is there any specific requirements? (I couldn't find any in the documentation). If there's any, please leave a link.

mmaietta commented 4 days ago
   ⨯ ENOENT: no such file or directory, rename '~\wp-downloader-electron\dist\win-arm64\win-arm64-unpacked\electron.exe' -> '~\wp-downloader-electron\dist\win-arm64\win-arm64-unpacked\wp-downloader-electron.exe'  failedTask=build

This smells like a bug. You're building on windows but the command rename '~\wp-downloader-electron has a ~ at the front of it? Did you do that for this? "The directory pathes are correct and there's full directory path. (I've omiited them here)"

sipsuru commented 4 days ago

Yeah, I meant, that I had full paths in terminal outputs, I removed them here thinking it'd better to have a look. Updated though.

So it was like this

⨯ ENOENT: no such file or directory, rename 'C:\Users\Dragon\Documents\GitHub\wp-downloader-electron\dist\win-arm64\win-arm64-unpacked\electron.exe' -> 'C:\Users\Dragon\Documents\GitHub\wp-downloader-electron\dist\win-arm64\win-arm64-unpacked\wp-downloader-electron.exe' failedTask=build

Sorry if it made any confusion.

JUNHAN12138 commented 2 days ago

Hello, have you solved your problem

sipsuru commented 2 days ago

Nope, I still couldn’t find anything, and I’m not sure if I’m doing something wrong either.

sipsuru commented 2 days ago

I’m not sure why, as I didn’t make any changes, but it successfully built a moment ago. It might be an issue with Electron or the build environment. I’ll go ahead and close this issue.

sipsuru commented 1 day ago

I got the error again.

Complete log

Job: https://github.com/sipsuru/wp-downloader-electron/actions/runs/11951692308/job/33315828519

Run npm run build:win npm run build:win shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'" env: NODE_JS_VERSION: 23.1.0

> wp-downloader-electron@1.0.0 build:win
> electron-builder --win
  • electron-builder  version=25.1.8 os=10.0.20[3](https://github.com/sipsuru/wp-downloader-electron/actions/runs/11951692308/job/33315828519#step:8:3)48
  • artifacts will be published if draft release exists  reason=CI detected
  • loaded configuration  file=D:\a\wp-downloader-electron\wp-downloader-electron\electron-builder.yml
  • executing @electron/rebuild  electronVersion=33.2.0 arch=x6[4](https://github.com/sipsuru/wp-downloader-electron/actions/runs/11951692308/job/33315828519#step:8:4) buildFromSource=false appDir=./
  • installing native dependencies  arch=x64
  • completed installing native dependencies
  • packaging       platform=win32 arch=x64 electron=33.2.0 appOutDir=dist\win-unpacked
  • downloading     url=https://npmmirror.com/mirrors/electron/v33.2.0/electron-v33.2.0-win32-x64.zip size=11[5](https://github.com/sipsuru/wp-downloader-electron/actions/runs/11951692308/job/33315828519#step:8:5) MB parts=8
  • downloaded      url=https://npmmirror.com/mirrors/electron/v33.2.0/electron-v33.2.0-win32-x[6](https://github.com/sipsuru/wp-downloader-electron/actions/runs/11951692308/job/33315828519#step:8:7)4.zip duration=1.147s
  • updating asar integrity executable resource  executablePath=dist\win-unpacked\wp-downloader-electron.exe
  • downloading     url=https://npmmirror.com/mirrors/electron-builder-binaries/winCodeSign-2.6.0/winCodeSign-2.6.0.[7](https://github.com/sipsuru/wp-downloader-electron/actions/runs/11951692308/job/33315828519#step:8:8)z size=5.6 MB parts=1
  • downloaded      url=https://npmmirror.com/mirrors/electron-builder-binaries/winCodeSign-2.6.0/winCodeSign-2.6.0.7z duration=2.5[8](https://github.com/sipsuru/wp-downloader-electron/actions/runs/11951692308/job/33315828519#step:8:9)6s
  • signing with signtool.exe  path=dist\win-unpacked\wp-downloader-electron.exe
  • no signing info identified, signing is skipped  signHook=false cscInfo=null
  • building        target=MSI arch=x64 file=dist\wp-downloader-electron 1.0.0.msi
  • building        target=zip arch=x64 file=dist\wp-downloader-electron-1.0.0-win.zip
  • building        target=7z arch=x64 file=dist\wp-downloader-electron-1.0.0-win.7z
  • executing @electron/rebuild  electronVersion=33.2.0 arch=ia32 buildFromSource=false appDir=./
  • installing native dependencies  arch=ia32
  • downloading     url=https://npmmirror.com/mirrors/electron-builder-binaries/wix-4.0.0.5512.2/wix-4.0.0.5512.2.7z size=2.2 MB parts=1
  • completed installing native dependencies
  • downloaded      url=https://npmmirror.com/mirrors/electron-builder-binaries/wix-4.0.0.5512.2/wix-4.0.0.5512.2.7z duration=6.742s
  • packaging       platform=win32 arch=ia32 electron=33.2.0 appOutDir=dist\win-ia32-unpacked
  • downloading     url=https://npmmirror.com/mirrors/electron/v33.2.0/electron-v33.2.0-win32-ia32.zip size=107 MB parts=8
  • downloaded      url=https://npmmirror.com/mirrors/electron/v33.2.0/electron-v33.2.0-win32-ia32.zip duration=15.035s
  • updating asar integrity executable resource  executablePath=dist\win-ia32-unpacked\wp-downloader-electron.exe
  • signing with signtool.exe  path=dist\win-ia32-unpacked\wp-downloader-electron.exe
  • no signing info identified, signing is skipped  signHook=false cscInfo=null
  • building        target=MSI arch=ia32 file=dist\wp-downloader-electron 1.0.0 ia32.msi
  • building        target=zip arch=ia32 file=dist\wp-downloader-electron-1.0.0-ia32-win.zip
  • building        target=7z arch=ia32 file=dist\wp-downloader-electron-1.0.0-ia32-win.7z
  • executing @electron/rebuild  electronVersion=33.2.0 arch=arm64 buildFromSource=false appDir=./
  • installing native dependencies  arch=arm64
  • completed installing native dependencies
  • packaging       platform=win32 arch=arm64 electron=33.2.0 appOutDir=dist\win-arm64-unpacked
  • downloading     url=https://npmmirror.com/mirrors/electron/v33.2.0/electron-v33.2.0-win32-arm64.zip size=120 MB parts=8
  • retrying        attempt=1
  • retrying        attempt=1
  • signing with signtool.exe  path=dist\wp-downloader-electron 1.0.0.msi
  • no signing info identified, signing is skipped  signHook=false cscInfo=null
  • signing with signtool.exe  path=dist\wp-downloader-electron 1.0.0 ia32.msi
  • no signing info identified, signing is skipped  signHook=false cscInfo=null
  • downloaded      url=https://npmmirror.com/mirrors/electron/v33.2.0/electron-v33.2.0-win32-arm64.zip duration=5m53.[9](https://github.com/sipsuru/wp-downloader-electron/actions/runs/11951692308/job/33315828519#step:8:10)01s
  ⨯ ENOENT: no such file or directory, rename 'D:\a\wp-downloader-electron\wp-downloader-electron\dist\win-arm64-unpacked\electron.exe' -> 'D:\a\wp-downloader-electron\wp-downloader-electron\dist\win-arm64-unpacked\wp-downloader-electron.exe'  failedTask=build stackTrace=Error: ENOENT: no such file or directory, rename 'D:\a\wp-downloader-electron\wp-downloader-electron\dist\win-arm64-unpacked\electron.exe' -> 'D:\a\wp-downloader-electron\wp-downloader-electron\dist\win-arm64-unpacked\wp-downloader-electron.exe'

I remoed target portable and then this happened.

And here the previous succesfull jobs (when having portable target.

So as far I understand, portable target replaced my nsis target back then, and when I removed portable target, I got the error again.

JUNHAN12138 commented 1 day ago

My solution is to set the electronList property in the build attribute of packagejson, with "electronList": "./main/electronList" Then compress the corresponding version of my electron into the folder corresponding to the electronList attribute,

mmaietta commented 17 hours ago

So I took a look at this and am unable to reproduce it. I also added a test case to the windows-latest CI runner and the test still passed successfully https://github.com/electron-userland/electron-builder/blob/993a077fffce68cb7bcc8442423dc0ee2daae874/test/src/windows/winPackagerTest.ts#L39-L49