The asar unpacked files are accessible only with functions like spawn/exec, see https://github.com/electron/electron/issues/6262
See original GitHub issue- electron-builder v11.2.4:
- ia32:
Hello,
There are two problems. The first one is that the regedit module is not saved automatically in app.asar.unpacked
The second problem is that it’s not really working even if I set manually the asarUnpack
value.
builder.build ({
// blabla
config: {
asarUnpack: [
'**node_modules/regedit/**',
],
}
// blabla
})
The regedit module spawn/exec (I don’t know exactly) wsf
and vbs
scripts.
In the win.asar.unpacked
directory I can find this module with all files. It looks perfect…
C:\blabla\win-ia32-unpacked\resources\app.asar.unpacked\node_modules\regedit
.
But when executing… it’s not working at all…
Input Error: Can not find script file "C:\blabla\win-ia32-unpacked\resources\app.asar\node_modules\regedit\vbs\regList.wsf".
Why the spawn/exec calls are not looking in the app.asar.unpacked
directory? asarUnpack
seems useless if it’s necessary to handle manually the location for the spawns. I’m doing something wrong?
Thanks for help Regards
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:13 (4 by maintainers)
Top Results From Across the Web
Getting path to asar.unpacked · Issue #6262 - GitHub
The asar unpacked files are accessible only with functions like spawn/exec, see https://github.com/electron/electron/issues/6262 ...
Read more >Allow ASAR to work with child_process.spawn() #9459 - GitHub
execFile, but only execFile is supported to execute binaries inside asar archive. This is because exec and spawn accept command instead of file...
Read more >Unable to access a file inside asar pacakge #751 - GitHub
Version: 6.7.3 Target: Linux, Windows I have some scripts in my app, which I need to execute when application starts. I am allowing...
Read more >child-process.spawn on exe in app.asar.unpacked causes ...
I expect to be able to invoke an exe which is in app.asar.unpacked ( C:\Program Files\MyElectronApp\resources\app.asar.unpacked\node_modules\ ...
Read more >spawn() in combination with app.asar and app.asar.unpacked ...
See my issue on johnvmt/node-desktop-screenshot#7 where to code is explained. Short story: When packaging for windows target with electron 1.4.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@develar I’ve make a module in order to handle this problem with only one line of code to add in the electron project, see https://github.com/epsitec-sa/hazardous
For example, with my sample:
The only thing to do is to add
require ('hazardous');
at the beginning of the main script of the app. Then, the functionsjoin()
,resolve()
andnormalize()
can return the unpacked location according to some conditions; just read the README for details.It feels like the hazardous library should be the normal behavior for these functions. Is there a reason it’s not?
In our case we’re exec’ing a java on the system and running a JAR file that’s packaged with the app. It’s convoluted but saved us development effort by not having to rewrite some functions in node.