How to package scripts launched as child processes in Electron app?
Asked Answered
A

0

6

My Electron app launches R scripts with the child_process module. In development, no problem. When the application is built (using electron-packager), the R scripts are not found. In the app folder, they're located in assets/rscripts.

What is the best way to package these scripts in the built app? I believe this applies for any kind of scripts or assets not directly related to the functioning of the app itself.

Authoritarian answered 3/7, 2016 at 7:15 Comment(4)
What exactly have you tried so far und which problems did you observe (e. g. packaging R runtimes for different OS, finding RScript path)?Automotive
Well I tried just to add them in the files section of package.json (which didn't work, obviously), read about making a node module and some other things but I'm a bit lost, I can't find any resources on how to properly package script assets (say in R, bash or any language) in Electron apps. The problem is always that these files are not found (because not .js, .css or .html so not packaged I guess). Maybe I could make the question more general as it's not related to the R language but just to the fact that those are add-ons in different languages than the ones used by Electron.Authoritarian
ACK, making this question independent of R would open it to a broader audience.Automotive
Could you check if moving your scripts into the electron apps root directory (or the respective relative directory) works? I can imagine that when calling the electron.exe instead of the script via node.js the relative directory changes.Tavarez

© 2022 - 2024 — McMap. All rights reserved.