Angular 如何在主渲染进程之外调用electron updater

Angular 如何在主渲染进程之外调用electron updater,angular,electron,electron-builder,electron-updater,Angular,Electron,Electron Builder,Electron Updater,我正在使用 我正在使用electron builder进行打包,该打包支持使用 通过从入口点调用函数,一切正常 import {autoUpdater} from 'electron-updater'; autoUpdater.checkForUpdatesAndNotify(); 我想从angular调用CheckforUpdates和Notify,以便用户可以通过单击按钮手动检查更新。 首先,我尝试了与我在main.ts中使用的方法相同的方法,但找不到该方法。所以我试图通过遥控器获取它,

我正在使用
我正在使用
electron builder
进行打包,该打包支持使用

通过从入口点调用函数,一切正常

import {autoUpdater} from 'electron-updater';
autoUpdater.checkForUpdatesAndNotify();

我想从angular调用
CheckforUpdates和Notify
,以便用户可以通过单击按钮手动检查更新。
首先,我尝试了与我在
main.ts
中使用的方法相同的方法,但找不到该方法。所以我试图通过
遥控器
获取它,但仍然得到一个错误

import { remote } from 'electron';

@Injectable()
export class UpdaterService {
  console.log('try update');
  remote.require('electron-updater').checkForUpdatesAndNotify();
  console.log('success');
}


怎么了?

它是
远程的。require('electron-updater')。autoUpdater。checkForUpdates()
它是
远程的。require('electron-updater')。autoUpdater。checkForUpdates()

uncaught TypeError: remote.require(...).checkForUpdatesAndNotify is not a function
    at SafeSubscriber._next (updater.service.ts:17)
    at SafeSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.__tryOrUnsub (Subscriber.js:192)
    at SafeSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.next (Subscriber.js:130)
    at Subscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._next (Subscriber.js:76)
    at Subscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.next (Subscriber.js:53)
    at MergeMapSubscriber.push../node_modules/rxjs/_esm5/internal/operators/mergeMap.js.MergeMapSubscriber.notifyNext (mergeMap.js:84)
    at InnerSubscriber.push../node_modules/rxjs/_esm5/internal/InnerSubscriber.js.InnerSubscriber._next (InnerSubscriber.js:15)
    at InnerSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.next (Subscriber.js:53)
    at ThrowIfEmptySubscriber.push../node_modules/rxjs/_esm5/internal/operators/throwIfEmpty.js.ThrowIfEmptySubscriber._next (throwIfEmpty.js:32)
    at ThrowIfEmptySubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.next (Subscriber.js:53)