electron-userland / electron-compile

DEPRECATED: Electron supporting package to compile JS and CSS in Electron applications
1.01k stars 99 forks source link

Cannot read property 'on' of undefined #226

Closed bencarter78 closed 7 years ago

bencarter78 commented 7 years ago

Hi there

I've just cloned a the electron-quick-start removed electron from the package.json dependencies and did...

npm install
npm install electron-prebuilt-compile
npm start

In main.js I changed const electron = require('electron-compile') to const electron = require('electron-compile') .

...and I get the following error...

App threw an error during load
TypeError: Cannot read property 'on' of undefined
    at Object.<anonymous> (/Users/bencarter/Code/electron/forms/src/main.js:42:4)
    at Object.<anonymous> (/Users/bencarter/Code/electron/forms/src/main.js:64:3)
    at Module._compile (module.js:571:32)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/bencarter/Code/electron/forms/node_modules/electron-compile/lib/require-hook.js:75:14)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at init (/Users/bencarter/Code/electron/forms/node_modules/electron-compile/lib/config-parser.js:292:16)
    at main (/Users/bencarter/Code/electron/forms/node_modules/electron-prebuilt-compile/lib/es6-init.js:40:29)
GVA info: Successfully connected to the Intel plugin, offline Gen9

What am I doing wrong?

MarshallOfSound commented 7 years ago

What terminal are you launching electron from?

bencarter78 commented 7 years ago

@MarshallOfSound iterm

MarshallOfSound commented 7 years ago

@bencarter78 That error is traditionally due to using tmux or launching from a terminal program embedded inside another Electron app.

Can you try launching from a clean instance of Terminal itself and seeing if the same thing happens (ensure anything like tmux is disabled)

bencarter78 commented 7 years ago

@MarshallOfSound tried a new instance of Terminal, same error. I've no idea what tmux is. Do you know how I check if I've got it and disable it if it's running?

MarshallOfSound commented 7 years ago

@bencarter78 If you don't know you almost certainly don't have it 😆

Oh wait

const electron = require('electron-compile') to const electron = require('electron-compile')

This is wrong, you shouldn't need to change that. Everything should still be

const electron = require('electron')
bencarter78 commented 7 years ago

Perfect! Thanks for your help @MarshallOfSound, really appreciate it! I guess I mis-read the documentation.