Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

142
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda