Electron - TypeError var.on is not a function

0

Following the standard primary structure templates offered by the Electron documentation ( link ), I encountered errors as the development of an application.

Displaying the required information, the message that appeared was: App threw an error during load TypeError: app.on is not a function The JavaScript error occurred in the main process Uncaught Exception: TypeError: app.on is not a function + location in code where app.on had

    
asked by anonymous 23.01.2018 / 09:07

1 answer

0

I found the solution more in the sixth sense of programmer than on the internet. In the documentation, the first line of code in the main.js file, which is linked in the package.json: "main": "main.js", the module is imported to a constant: const {app, BrowserWindow} = require ('electron') my code started to run after changing to a variable: var {app, BrowserWindow} = require ('electron')

I hope I have helped :) It gave me a good headache. If you know of any vulnerability that this exchange brings, please comment.

    
23.01.2018 / 09:07