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

Node modules, that must be unpacked, are not detected automatically

Open PF4Public opened this issue 2 years ago • 6 comments

  • Electron-Builder Version: 22.11.4
  • Node Version: 14.17.6
  • Electron Version: 18.0.3
  • Electron Type (current, beta, nightly):
  • Target: any

electron-builder does not unpack node modules in vector-im/element-desktop. "asarUnpack": "**/*.node", helps as a workaround. As far as I understand they "yarn link" those two node_modules from build directory to the project directory, which makes them symlinks instead of normal directories. Could this be preventing electron-builder from unpacking them?

For your reference: vector-im/element-desktop#337

PF4Public avatar Apr 13 '22 21:04 PF4Public

That sounds like a similar environment/situation as to what pnpm uses. The upstream package is https://github.com/develar/app-builder that parses the dependency tree to generate the list to copy. Unfortunately, it doesn't seem to handle symlinks AFAICT

mmaietta avatar Apr 13 '22 22:04 mmaietta

Which means it is unfixable or should I file yet another issue there? :D

PF4Public avatar Apr 13 '22 22:04 PF4Public

We are having the same problem: https://github.com/WowUp/WowUp/issues/1125

Several other projects too actually, f.e. https://github.com/jitsi/jitsi-meet-electron/issues/556

ilu33 avatar Apr 17 '22 12:04 ilu33

@mmaietta is there an issue tracking this symlink issue in app-builder?

hipstersmoothie avatar Jul 28 '22 18:07 hipstersmoothie

Not that I'm aware of, I don't manage that project. Please create an issue there with your details

mmaietta avatar Jul 28 '22 18:07 mmaietta

electron-builder (23.3.3) on Windows doesn't seem to be unpacking normal non-symlink node modules for me. Running this should quickly demonstrate the issue:

git clone [email protected]:electron/electron-quick-start.git && \
cd electron-quick-start && \
npm i native-hello-world && \
npm i -D electron-builder && \
./node_modules/.bin/electron-builder --dir && \
npx asar extract dist/win-unpacked/resources/app.asar app.asar.unpacked && \
ls -al dist/win-unpacked/resources && \
ls -al app.asar.unpacked/node_modules/native-hello-world/build/Release

But the documentation says:

Node modules, that must be unpacked, will be detected automatically, you don’t need to explicitly set asarUnpack - please file an issue if this doesn’t work.

I don't see where in unpackDetector.ts it's detecting node modules to be unpacked. It appears to only detect .dll, .exe, .dylib. .so, ffprobe-static, ffmpeg-static, and binary files that don't have a ".".

jeremyspiegel avatar Aug 16 '22 22:08 jeremyspiegel

I'm having code signing issues because electron not unpacking node_modules nut.js/512

freddy-daniel avatar May 30 '23 08:05 freddy-daniel