简体   繁体   English

未捕获的类型错误:无法使用 Electron 更新程序代码读取未定义的属性“on”

[英]Uncaught TypeError: Cannot read property 'on' of undefined with Electron updater code

I want to add update function to my electron app.我想将更新 function 添加到我的 electron 应用程序中。 So I search about it and I found there is 'eletron-updater' package.所以我搜索了一下,发现有“eletron-updater”package。 So I apply electron updater codes to my app.因此,我将 electron 更新程序代码应用于我的应用程序。 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.当我单击“检查更新”按钮时,应该会出现新的更新检查 window 并检查是否有更新。

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.但是当我在主页的 index.js 中粘贴代码时,它可以工作。 Is there any ways to put that code in UpdateWindow.vue?有什么方法可以将该代码放入 UpdateWindow.vue 中?

The cannot read property 'on' of undefined indicates to me, that the object you added the EventListener to is not defined. undefined 的无法读取属性“on”向我表明,您添加 EventListener 的 object 未定义。 You should check if it is a reference, for example log the variable to the console before adding the EventListener.您应该检查它是否是引用,例如在添加 EventListener 之前将变量记录到控制台。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 未捕获的TypeError:无法读取未定义的属性'fn',电子2,角6? - Uncaught TypeError: Cannot read property 'fn' of undefined, electron 2, angular 6? 带有 Electron 的 TestCafe 抛出“Uncaught TypeError: Cannot read property 'source' of undefined” - TestCafe with Electron throwing "Uncaught TypeError: Cannot read property 'source' of undefined" electron v10.1.1 给出 Uncaught TypeError: Cannot read property 'dialog' of undefined,但相同的代码在 electron v9.3.0 中有效 - electron v10.1.1 gives Uncaught TypeError: Cannot read property 'dialog' of undefined, but same code works in electron v9.3.0 未捕获的TypeError:无法读取未定义的属性“未定义” - Uncaught TypeError: Cannot read property 'undefined' of undefined 电子类型错误:无法读取未定义的属性“ normalizePath” - Electron TypeError: Cannot read property 'normalizePath' of undefined 未捕获的类型错误:无法读取未定义的属性“on”。 我也尝试重新安装电子 - Uncaught TypeError: Cannot read property 'on' of undefined. I have tried to reinstall electron as well 未捕获的TypeError:无法读取未定义的属性“ 1” - Uncaught TypeError: Cannot read property '1' of undefined 未捕获的TypeError:无法读取未定义的属性“格式” - Uncaught TypeError: Cannot read property 'format' of undefined 未捕获的TypeError:无法读取未定义的属性“属性” - Uncaught TypeError: Cannot read property 'attributes' of undefined JSON-未捕获的TypeError:无法读取未定义的属性 - JSON - Uncaught TypeError: Cannot read property of undefined
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM