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

219
Visualizações
Electron Forge Error - cannot read property 'close' of undefined

I just set up a basic electron-react app by using electron-forge and adding React+webpack+typescript per instructions and it all works great (I haven't added anything beyond the basic setup). It compiles well with all green checkboxes.

However, when I hit the close button by mouse clicking the x in the top right, it shuts down but gives the following error:

An unhandled exception has occurred inside Forge:
Cannot read property 'close' of undefined
TypeError: Cannot read property 'close' of undefined
    at WebpackPlugin.exitHandler (C:\Users\cwebb\Documents\Webdev\Atlas\node_modules\@electron-forge\plugin-webpack\src\WebpackPlugin.ts:83:16)
    at ChildProcess.<anonymous> (C:\Users\cwebb\Documents\Webdev\Atlas\node_modules\@electron-forge\plugin-webpack\src\WebpackPlugin.ts:171:18)
    at ChildProcess.emit (events.js:412:35)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
C:\Users\cwebb\Documents\Webdev\Atlas\node_modules\@electron-forge\plugin-webpack\dist\WebpackPlugin.js:87
          server.close();
                 ^

TypeError: Cannot read property 'close' of undefined
    at WebpackPlugin.exitHandler (C:\Users\cwebb\Documents\Webdev\Atlas\node_modules\@electron-forge\plugin-webpack\src\WebpackPlugin.ts:83:16)
    at process.<anonymous> (C:\Users\cwebb\Documents\Webdev\Atlas\node_modules\@electron-forge\plugin-webpack\src\WebpackPlugin.ts:126:40)
    at process.emit (events.js:412:35)
    at process.emit (C:\Users\cwebb\Documents\Webdev\Atlas\node_modules\source-map-support\source-map-support.js:516:21)
    at processEmit [as emit] (C:\Users\cwebb\Documents\Webdev\Atlas\node_modules\signal-exit\index.js:155:35)
    at process.exit (internal/process/per_thread.js:169:15)
    at process.<anonymous> (C:\Users\cwebb\Documents\Webdev\Atlas\node_modules\@electron-forge\cli\src\util\terminate.ts:20:11)
    at process.emit (events.js:400:28)
    at process.emit (C:\Users\cwebb\Documents\Webdev\Atlas\node_modules\source-map-support\source-map-support.js:516:21)
    at processEmit [as emit] (C:\Users\cwebb\Documents\Webdev\Atlas\node_modules\signal-exit\index.js:161:32)
    at process._fatalException (internal/process/execution.js:167:25)

Any recommendations as to how to correct this? I found one answer on a gitmemory site but it just said "thanks it worked" but no comment about how to fix the problem.

Thank you in advance for your help.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I just ran into this today and managed to find a hint here

You have to bind to the Electron app's window-all-closed event if you don't want this to happen. Usually, you'd use this event to quit the app when all the windows are closed. Here's an example snippet from main.js:

const { app } = require('electron')
app.on('window-all-closed', () => {
  app.quit() 
})

If you want the app to keep running after you close all windows, you can remove the call to app.quit, but make sure to keep the binding to window-all-closed. Having the binding prevents the exception from being thrown.

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