bigtunacan
bigtunacan

Reputation: 4976

Electron cannot read property getName of undefined

I was following the Electron menu example at http://electron.atom.io/docs/v0.36.5/api/menu/, however I receive the error

Cannot read property 'getName' of undefined

This is occurring at the point where require('electron').app.getName(); is called.

When I open the dev tools and take a look I see that require('electron') appears to load correctly, but require('electron').app returns undefined.

Upvotes: 2

Views: 1564

Answers (1)

Vadim Macagon
Vadim Macagon

Reputation: 14837

I'm going to assume you're doing this in the main process, if so you might want to check if you have another electron module installed somewhere, as mentioned in the FAQ: https://github.com/atom/electron/blob/v0.36.6/docs/faq/electron-faq.md#requireelectronxxx-is-undefined

Upvotes: 1

Related Questions