Skip to content
This repository has been archived by the owner on Apr 29, 2021. It is now read-only.

Debugging the App

Suraj Pindoria edited this page Apr 27, 2017 · 1 revision

Electron Prebuilt

This is by far the fastest method for debugging the desktop app. It will require that you install the electron module to your system, npm install -g electron.

In order to run the electron command you need to have completed 2 tasks beforehand:

  1. Copy the package.json from phonegap-app-desktop/src/config/ to phonegap-app-desktop/www/
  2. Run npm install inside phonegap-app-desktop/www/

Once you have done this you can run the app using electron www/ from the root directory or electron . if you are inside the www directory. This will launch desktop app in a new electron window along with the developer tools console. If the app launches without the developer console, check that in the package.json the option for devTools is set to true:

"window"  : {
  "devTools" : true
},

If you want to debug a particular node module you can edit them from phonegap-app-desktop/www/node_modules/. In order for the new changes to take affect you will need to refresh the desktop app. You can do this by going to the developer console and pressing Cmd-R if on OS X or Ctl-R if on Windows. Any debug statements that you added should now be visible in the developer console.

Grunt

This method is a little slower but will take care of the manual steps that are required when using the electron command. You will need to install the grunt CLi using npm install -g grunt. From the project root just run the command grunt and this will build and package the desktop app.

When this has finished the app will be located in phonegap-app-desktop/build/PhoneGap-<platform>/ folder. To run the app on OS X double click PhoneGap.app and on Windows double click PhoneGap.exe. This will launch the desktop app with the developer tools console. If you are working on Windows, follow the instructions in phonegap-app-desktop/INSTALL to install the necessary dependencies.

Using grunt you can only edit the node modules if you are working on OS X. To do this edit the particular module you want from phonegap-app-desktop/build/PhoneGap-darwin-x64/PhoneGap.app/Contents/Resources/app/node_modules/ and refresh the desktop app.