【问题标题】:Trouble importing electron-updater导入电子更新程序时遇到问题
【发布时间】:2022-01-08 00:24:01
【问题描述】:

我无法将 electron-updater 集成到我的项目中。我正在使用 Windows 系统。

首先我安装了电子更新器(通过 npm 或 yarn),它可以正常工作。

然后我通过 import { autoUpdater } from 'electron-updater'const {autoUpdater} = require('electron-updater')

一旦我构建并运行应用程序,我会得到一个 App threw an error during load 并带有以下类型错误:

TypeError: Cannot read property 'name' of undefined
      at exports.fromCallback (E:\smaek-mm\node_modules\universalify\index.js:15:26)
      at Object.<anonymous> (E:\smaek-mm\node_modules\electron-updater\node_modules\fs-extra\lib\fs\index.js:57:27)
      at Object.<anonymous> (E:\smaek-mm\node_modules\electron-updater\node_modules\fs-extra\lib\fs\index.js:121:3)
      at Module._compile (module.js:642:30)
      at Object.Module._extensions..js (module.js:653:10)
      at Module.load (module.js:561:32)
      at tryModuleLoad (module.js:504:12)
      at Function.Module._load (module.js:496:3)
      at Module.require (module.js:586:17)
      at require (internal/module.js:11:18)

尝试了不同版本的 electron-updater、electron-builder、node 和 npm,尝试通过 yarn 构建,有或没有分布设置(通用) => 都导致基本相同的问题。

我的项目使用SimulatedGREG/electron-vue。 可以通过设置默认样板、安装 electron-updater 并取消注释准备好的 autoLoad 代码来重现问题。

有什么想法吗?我基本上被困了一天,找不到前进的路。

【问题讨论】:

    标签: javascript electron electron-builder electron-vue electron-updater


    【解决方案1】:

    似乎SimulatedGREG/electron-vue 使用了一个非常过时的电子版本:

    "electron": "^2.0.4"
    

    实际上,这确实适用于最新的电子生成器:

    "electron-builder": "^22.14.5"
    

    但它不适用于最新的电子更新器:

    "electron-updater": "^4.6.5"
    

    将电子升级到最新版本解决了这个问题:

    "electron": "^16.0.3"    
    

    更多关于在 electron-vue 中升级电子的信息可以在这里找到: SimulatedGREG/electron-vue #871

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-05-14
      • 1970-01-01
      • 2022-01-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多