Skip to content

Question about using Electron for my use case #9073

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

Open
Wolphen opened this issue Apr 30, 2025 · 1 comment
Open

Question about using Electron for my use case #9073

Wolphen opened this issue Apr 30, 2025 · 1 comment

Comments

@Wolphen
Copy link

Wolphen commented Apr 30, 2025

Hello,

I’m developing an application with a React front end and an Express back end, packaged with Electron v35.0.3 and electron-builder v24.3.0.

Currently, I have : "asar": false in my build configuration because I keep running into issues with my upload routes (front → back). I’m also embedding ADB via adbkit directly in the server, which requires elevated permissions when running the resulting .exe.

With asar: false, everything works—but all files remain fully accessible, and I’d like to re-enable ASAR for better security and packaging. However, when I set "asar": true and rebuild, I consistently get HTTP 500 errors on /upload, and it seems certain server-linked components (like adbkit) stop working entirely: they no longer prompt for admin rights and no longer detect USB connections—yet the same code works perfectly with ASAR disabled.

I would greatly appreciate any advice on:

How to configure ASAR (and any necessary unpack/unpack-smart rules) so that my Express upload routes and adbkit integration continue to function without reverting to "asar": false.

Best practices for embedding native dependencies (ADB) in an Electron + Express build that requires admin permissions on Windows.

Please let me know if you need more details on my configuration or any error logs.

Current electron-builder configuration

{
"build": {
"appId": "x",
"directories": {
"output": "dist"
},
"files": [
"udpDevices.json",
"server.js",
"main.js",
"",
"client/build/**/
",
"/*",
"!dist/
/*"
],
"asar": false,
"win": {
"target": "dir",
"icon": "build/icon.ico",
"compression": "store"
}
}
}

Thank you in advance for your help!

Best regards,
Wolphen

@mmaietta
Copy link
Collaborator

You might need to leverage extraFiles or extraResources for some of your assets, as my guess is that having them all embedded in the asar is causing the issue. Alternative route is to use asarUnpack but I don't know your repo setup/hierarchy to provide any additional insight there. Utilizing asarUnpack would have the files accessible as OS executables, versus I think not being able to do so from within the asar? Not sure tbh, but a minimum repro repo or a link to your project would help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants