Launching file within an asar


From checking the documentation it appears that you can’t child_process.spawn a binary or file within an asar. It seems that only child_process.execFile can do that. Will this also allow you to specify a path within the asar as an argument to a binary? For instance, if I wanted to do something like…


Would this work or does it only apply to the binary that you are attempting to launch within? My code seems to function normally without everything packaged into an asar but if it is… nothing happens. I haven’t tried execFile yet though.


I ran into the same problem.
It seems that once packaged, this execFile does not work (it does in normal mode).
I’d love to know if there’s a solution.


What is the file you are trying to execute? If it’s a node script you could use fork instead of execfile and it should work. Otherwise, I believe your only option is to have the file external to the asar


Thanks for the reply.
The file I’m trying to execute is a server.js which should launch an http server when performing node server.js.
More precisely, I’m trying:
cp.execFile(path.join(__dirname, 'node_modules/my-module/server.js').
By the way - that’s the command used within this module’s npm start.
Any idea how can I execute it ?


small correction:
cp.execFile('node', path.join(__dirname, 'node_modules/my-module/server.js')).

cp.fork(path.join(__dirname, 'node_modules/my-module/server.js')) doesn’t work for me when the app is packaged.