ElectronAppAdapter Uncaught TypeError: Cannot read property 'getVersion' of undefined
See original GitHub issue- Version: 4.3.1
-
Electron Version: v8.2.4
-
Electron Type (current, beta, nightly): current
Hey, I’m using this package with my angular electron application example repo.
I have written this angular service:
import { Injectable } from '@angular/core';
import { autoUpdater } from 'electron-updater';
@Injectable({ providedIn: 'root' })
export class AppUpdateService {
constructor() { }
checkForUpdates() {
const res = autoUpdater.checkForUpdates()
console.log(res);
}
}
But when I try this function it throws an exception:
Uncaught TypeError: Cannot read property 'getVersion' of undefined
at ElectronAppAdapter.get version [as version] (ElectronAppAdapter.js:34)
at new AppUpdater (AppUpdater.js:232)
at new BaseUpdater (BaseUpdater.js:20)
at new NsisUpdater (NsisUpdater.js:126)
at doLoadAutoUpdater (main.js:129)
at Object.get [as autoUpdater] (main.js:142)
at Module../src/app/services/app-update.service.ts (app-update.service.ts:4)
at __webpack_require__ (bootstrap:79)
Proposal for a fix:
More thing, I have tried to fix this problem myself, and I found if you change ElectronAppAdapter
constructor from: constructor(app = require("electron").app)
,
to this: constructor(app = require("electron").remote.app)
.
everything fixes.
Any other ideas ?
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Electron does not get valid version data through the app ...
At first I thought the error is from electron version is so low. But I read 3.1.X document there is app.getVersion() method and...
Read more >1374939 – atom editor: TypeError: Cannot read property ...
Bug 1374939 - atom editor: TypeError: Cannot read property 'getVersion' of undefined. Summary: atom editor: TypeError: Cannot read property ...
Read more >[Electron Quick Start Issue] TypeError: Cannot read property ...
I was following Writing Your First Electron App https://electronjs.org/docs/tutorial/first-app I got the error as titled. I searched and a solution is found ...
Read more >electron.App.getVersion JavaScript and Node.js code examples
ipcMain.on('request-set-about', (event, arg) => { let Data = { version: app.getVersion(), arch: os.arch(), platform: process.platform }; ...
Read more >How to call electron-updater outside the main rendering process
uncaught TypeError : remote.require(...). ... TypeError: Cannot read property 'map' of undefined with Angular v6.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Same here!
Did you ever solved this Issue? I have the same Problem. If i use checkForUpdates in Angular i am getting this error. If i use it in the Main.ts File everything works fine.