I get this error when i run electron app.js but when i run electron index.html everything works fine
i got this in my app.js file
var electron = require('electron')
electron.app.on('ready', function () {
var mainWindow = new electron.BrowserWindow({width: 600, height: 800})
mainWindow.loadURL('file://' + __dirname + '/index.html')
})
App threw an error when running
[TypeError: Cannot read property 'on' of undefined]
A JavaScript error occurred in the main process
Uncaught Exception:
TypeError: Cannot read property 'on' of undefined
at Object.<anonymous> (/home/jose/electron/app.js:3:13)
at Module._compile (module.js:425:26)
at Object.Module._extensions..js (module.js:432:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:313:12)
at loadApplicationPackage (/usr/local/lib/node_modules/electron-prebuilt/dist/resources/default_app/main.js:257:23)
at Object.<anonymous> (/usr/local/lib/node_modules/electron-prebuilt/dist/resources/default_app/main.js:289:5)
at Module._compile (module.js:425:26)
at Object.Module._extensions..js (module.js:432:10)
at Module.load (module.js:356:32)
I get this error when i run
electron app.js
but when i runelectron index.html
everything works fine i got this in my app.js fileApp threw an error when running