Praveer Kumar
Praveer Kumar

Reputation: 1018

How to debug Electron main process after packaging?

I have created an Electron App(say MyApp). I have used electron-packager to pack the App. I installed the app in my local machine and I can see MyApp in the start menu. When I click on the Icon It launches the app but I am not able to debug it. I can see the devtool

Electron version : "^5.0.7"

Electron Packager: "^12.2.0" OS: Windows

Thanks in advance

Upvotes: 5

Views: 2498

Answers (1)

Keith Ndhlovu
Keith Ndhlovu

Reputation: 51

I think the best way debug your main process would be to do so during development, i have found the information here on the Electron docs to be very useful https://electronjs.org/docs/tutorial/debugging-main-process

Also my Code Editor of choice is VSCode so i was able to use this link https://electronjs.org/docs/tutorial/debugging-main-process-vscode

Its also good practice to have a Crash Reporter setup, Electron has the default one https://electronjs.org/docs/api/crash-reporter which also work great, but you can add other third party libraries like Bugsnag, Sentry or Backtrace.io.

Default Electron Crash Reporter

const { crashReporter } = require('electron')

crashReporter.start({
  productName: 'YourName',
  companyName: 'YourCompany',
  submitURL: 'https://your-domain.com/url-to-submit',
  uploadToServer: true
})

Using Sentry "You need an account for this option"


//You need to call init in your main and every renderer process you spawn. 
import * as Sentry from '@sentry/electron';
Sentry.init({dsn:'https://<your-key-here>@sentry.io/15...5'});

Upvotes: 2

Related Questions