max-mapper / elementary-electron

NodeSchool workshop for learning Electron
228 stars 44 forks source link

i got an error when runing the tutorials #2

Open Osezno opened 8 years ago

Osezno commented 8 years ago

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)
luludotdev commented 8 years ago

You've not defined 'app' const app = electron.app; // Module to control application life.