New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash when running as a packaged app with electron-builder on macOS #1
Comments
Should be fixed in |
Actually, the package.json is getting included in the asar, but is still not being recognised. I originally thought this was because we're using the dual package.json structure recommended by electron-builder, since our outer package.json has no Interesting to note that if there's a package.json outside the asar with a name field, the crash doesn't occur, but that's unlikely to happen if the .app gets copied to /Applications |
Ah, this could be because both main.js and package.json are in the root of the asar, but it looks like |
…hmm, unless that's the parent of the conf module, i.e. the node_modules dir. |
"Parent dir" being the directory of the parent (caller) module, which is your app. |
The parent is actually the electron-config module. Docs say:
conf isn't required directly from our app. I added some logging, and here's the parent dir it starts on, and the package.json it finds:
vs when running in dev mode, unpacked:
So it looks like it's having trouble traversing the asar tree. It should be finding the inner package.json at:
Or unpacked at:
|
Perhaps your path-exists isn't taking advantage of electron's patched fs calls that allow asar traversal: |
There's nothing for |
You're using fs.access(Sync) in path-exists, which isn't patched, but fs.exists(Sync) is: |
Ah, nice catch! That sounds like an Electron bug (You know what to do). Electron should be patching that |
Cheers! There's still the issue of the incorrect module.parent, shall I open a separate ticket? |
@jwheare On |
env-paths expects a String, but conf is passing in an undefined
opts.projectName
, because electron-config is settingopts.cwd
directly so it isn't needed.This fails because the package.json isn't bundled into the asar file when built, so pkg-up finds nothing.
Not sure which package this should be fixed in.
Also, a fresh npm install results in this version tree:
conf depends on env-paths: ^0.2.0 which won't allow 0.3.0
The text was updated successfully, but these errors were encountered: