0

I've been playing around with Electron and AngularJS and built a simple app. If I run it with electron it works as expected. After using electron-packager to package the app into a win32 executable It does not work anymore. (Opens white window and that's it).

Is there anyway to see some debug when packaged? I don't know what's wrong, the only thing that I might have done "wrong" is include some external CDN libraries. Is that allowed in Electron or must I install everything with node?

2
  • I don't think it's a good idea to use CDNs in Electron, your app will end up taking longer to startup and won't work offline. However, that should still work, open up DevTools and have a look (this question may be relevant). Commented Feb 25, 2016 at 7:09
  • Thank you. I had a few errors including some libs that had absolute paths outside of the project. CDN's are not a problem. Commented Feb 27, 2016 at 13:55

1 Answer 1

1

To debug effectively in Electron, you have to turn on browser embedded developer tools inside the main.js file of your app, then access them once electron launches. For example, below is some code which will load your app and turn on a menu with a sub-menu that launches developer tools for Chrome (or via the shortcut defined herein as Ctrl-Shift-I for Windows).

app.on('ready', function () { 'use strict'; var path = require('path'); var iconPath = path.resolve(__dirname, './dist/app.ico'); const appIcon = new Tray(iconPath); mainWindow = new Window({ width: 1280, height: 1024, autoHideMenuBar: false, useContentSize: true, resizable: true, icon: iconPath // 'node-integration': false // otherwise various client-side things may break }); appIcon.setToolTip('My App'); mainWindow.loadURL('http://localhost:3000/'); var template = [ { label: 'View', submenu: [ { label: 'Toggle Developer Tools', accelerator: (function() { if (process.platform === 'darwin') { return 'Alt+Command+I'; } else { return 'Ctrl+Shift+I'; } })(), click: function(item, focusedWindow) { if (focusedWindow) { focusedWindow.toggleDevTools(); } } }, ] } ]; var menu = Menu.buildFromTemplate(template); Menu.setApplicationMenu(menu); mainWindow.focus(); }); 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.