0
votes

I want to add update function to my electron app. So I search about it and I found there is 'eletron-updater' package. So I apply electron updater codes to my app. But It's not working with an error.

My app has main parent page and there is 'Check update' button. And When I click 'Check update' button, the new update check window should be comes out and checks if there is update.

But when I paste part of 'electron-updater' codes my app's main page got empty and it shows me an error.

[Error]

Uncaught TypeError: Cannot read property 'on' of undefined
    at eval (index.vue?6ced:26)
    at Module../node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/index.js?!./src/renderer/components/UpdateWindow/index.vue?vue&type=script&lang=js& (renderer.js:990)
    at __webpack_require__ (renderer.js:791)
    at fn (renderer.js:102)
    at eval (index.vue?9264:1)
    at Module../src/renderer/components/UpdateWindow/index.vue?vue&type=script&lang=js& (renderer.js:3449)
    at __webpack_require__ (renderer.js:791)
    at fn (renderer.js:102)
    at eval (index.vue?b6ec:1)
    at Module../src/renderer/components/UpdateWindow/index.vue (renderer.js:3437)

And When I remove my code and it my main app works well. But I don't know why it's not working. But When I paste code in index.js in main page it works. Is there any ways to put that code in UpdateWindow.vue?

1

1 Answers

0
votes

The cannot read property 'on' of undefined indicates to me, that the object you added the EventListener to is not defined. You should check if it is a reference, for example log the variable to the console before adding the EventListener.