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

216
Views
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 answers
Answer question

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 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!