Lesson 17 of 28
javascriptDebugging – DevTools, Remote Debugging & Logging
9 mins
Course progress61%
What you'll learn
Keep these ideas in mind as you work through the lesson.
Lesson 17 of 28
javascript9 mins
Keep these ideas in mind as you work through the lesson.
win.webContents.openDevTools({ mode: 'detach' });
You can also enable it only in development:
if (!app.isPackaged) win.webContents.openDevTools();
Launch Electron with the --remote-debugging-port flag:
electron . --remote-debugging-port=9222
Then connect from Chrome at http://localhost:9222.
const log = require('electron-log');
log.info('App started');
log.error('Oops');
The log file is saved to app.getPath('logs')/main.log.
app.on('render-process-gone', (event, webContents, details) => {
log.error(`Renderer crashed: ${details.reason}`);
});
Use the electron-debug module for hot‑reloading shortcuts during development.