npm-kubo icon indicating copy to clipboard operation
npm-kubo copied to clipboard

Cannot use with electron-builder when asar: false

Open RangerMauve opened this issue 2 years ago • 1 comments

I'm trying to use this module for the Agregore Browser with the latest version of Electron and I'm trying to use ESM.

Although Electron doesn't support ESM natively, it's possible to use it if one disables ASAR support and imports files from the filesystem.

However, for some reason electron-builder has been getting me the following error when I try to build a binary without ASAR (on Liunux). You can find more detailed build logs here: https://github.com/AgregoreWeb/agregore-browser/actions/runs/4009313691/jobs/6884515962#step:5:99

 • asar usage is disabled — this is strongly not recommended  solution=enable asar and use asarUnpack to unpack files that must be externally available
  ⨯ ENOENT: no such file or directory, symlink '/home/mauve/programming/agregore-browser/node_modules/go-ipfs/go-ipfs/ipfs' -> '/home/mauve/programming/agregore-browser/release/linux-unpacked/resources/app/node_modules/go-ipfs/bin/ipfs'  failedTask=build stackTrace=Error: ENOENT: no such file or directory, symlink '/home/mauve/programming/agregore-browser/node_modules/go-ipfs/go-ipfs/ipfs' -> '/home/mauve/programming/agregore-browser/release/linux-unpacked/resources/app/node_modules/go-ipfs/bin/ipfs'
    at processImmediate (node:internal/timers:471:21)
From previous event:
    at Object.copyAppFiles (/home/mauve/programming/agregore-browser/node_modules/app-builder-lib/src/util/appFileCopier.ts:85:27)

Sometimes not using ASAR is important to making apps work and this is currently prevent that option from being pursued.

Are there any thoughts on what can be done about this or what I can do to debug the issue further?

I'll post any fixes I find here as I go.

RangerMauve avatar Jan 25 '23 19:01 RangerMauve

I ended up having asar:true but extracting pretty much all the files at runtime to get it to work. 🙃

https://github.com/electron/electron/issues/21457#issuecomment-1404327157

RangerMauve avatar Jan 25 '23 22:01 RangerMauve