ipfs / npm-kubo

Install Kubo (go-ipfs) from NPM
https://www.npmjs.com/package/kubo
MIT License
41 stars 30 forks source link

Cannot use with electron-builder when asar: false #56

Open RangerMauve opened 1 year ago

RangerMauve commented 1 year ago

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 commented 1 year ago

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