question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 3 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
stoeflncommented, May 27, 2021

Same here!

3reactions
danielehrhardtcommented, Apr 6, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found