Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

141
Views
Electron app not spawning child process when moved to different folder

When a button is clicked in my app, a child process is spawned using the fork() function. This works as intended, even when bundled into an exe in my dist folder (via electron-builder). However, when I move the folder win-unpacked to another folder for testing, the child process is not spawned.

The dist folder structure is as shown:

dist
|-.icon-ico
|- win-unpacked
|- builder-debug.yaml
|- builder-effective-config.yaml

The win-unpacked is where all the main files are (such as app.asar, app.exe and such).

When it is in my main development folder such as this:

app
|-build
|-node_modules
|-dist
|-public
|-src

The child process is spawned, however, in the testing folder which just contains dist, the child process is not spawned.

To spawn the child process I have used:

child = fork(require("path").join(__dirname, "sts/states.js"));

In console, the __dirname is logged as C:\Users\me\Documents\mainApp\dist\win-unpacked\resources\app.asar\build.

the sts folder is located in build folder.

I do not actually know what the reason is to why this is not working when I take dist out of my app folder and place it into another folder for testing.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

With some help from this answer, I managed to get some direction. I added:

"build": {
    "extraResources": "node_modules",
    "files": [
      "!node_modules"
    ]
}

to my package.json and now it is spawning the child process. The downside is that the file is now larger (1.45GB).

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!