You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Electron自动更新Mac端下载成功但安装时提示‘命令已禁用无法执行’且重启循环的问题求助

Electron自动更新Mac端下载成功但安装时提示‘命令已禁用无法执行’且重启循环的问题求助

大家好,我们在Mac端使用Electron自动更新功能时遇到了一个棘手的问题:更新包已经成功下载,也弹出了重启应用的提示,但点击“重启”后,整个流程陷入循环,而且日志里显示错误信息:The command is disabled and cannot be executed,报错位置在MacUpdater.js的this.nativeUpdater.checkForUpdates()这一行。

以下是我们使用的相关代码:

autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => {
  log.info('updated-download event'+releaseName+releaseNotes)
  const dialogOpts = {
    type: 'info',
    buttons: ['Restart', 'Later'],
    title: 'Application Update',
    message: process.platform === 'win32' ? releaseNotes : releaseName,
    detail: 'A new version has been downloaded. Restart the application to apply the updates.',
  }
  dialog.showMessageBox(dialogOpts).then((returnValue) => {
    if (returnValue.response === 0) {
      setTimeout(() => {
        autoUpdater.quitAndInstall()
        app.exit();
      }, 6000);
    }
  });
})

对应的错误日志如下:

[2023-04-27 23:14:33.708] [info]  Checking for update
[2023-04-27 23:14:34.833] [info]  Found version 1.0.1 (url: /download/flavor/default/1.0.1/osx_arm64/<App>-1.0.1-arm64-mac.zip)
[2023-04-27 23:14:34.834] [info]  update available [object Object]
[2023-04-27 23:14:34.834] [info]  Downloading update from /download/flavor/default/1.0.1/osx_arm64/<App>-1.0.1-arm64-mac.zip
[2023-04-27 23:14:34.840] [info]  Checked for macOS Rosetta environment (isRosetta=false)
[2023-04-27 23:14:34.843] [info]  Checked 'uname -a': arm64=true
[2023-04-27 23:14:34.944] [info]  Update has already been downloaded to /Users/$user/Library/Application Support/Caches/<App>-updater/pending/<App>-1.0.1-arm64-mac.zip).
[2023-04-27 23:14:34.948] [info]  updated-download
[2023-04-27 23:14:36.993] [warn]  Error: The command is disabled and cannot be executed
at Server.<anonymous> (/Applications/<App>/Contents/Resources/app.asar/node_modules/electron-updater/out/MacUpdater.js:180:40)
at Object.onceWrapper (node:events:627:28)
at Server.emit (node:events:513:28)
at emitListeningNT (node:net:1774:10)
at process.processTicksAndRejections (node:internal/process/task_queues:81:21)
[2023-04-27 23:14:36.995] [error] Error: Error: The command is disabled and cannot be executed
at Server.<anonymous> (/Applications/Zaperon.app/Contents/Resources/app.asar/node_modules/electron-updater/out/MacUpdater.js:180:40)
at Object.onceWrapper (node:events:627:28)
at Server.emit (node:events:513:28)
at emitListeningNT (node:net:1774:10)
at process.processTicksAndRejections (node:internal/process/task_queues:81:21)

有没有同学也遇到过这个问题?我们还尝试过按照一些社区帖子的建议,改用autoUpdater.nativeUpdater.quitAndInstall(),但还是没能解决问题。

备注:内容来源于stack exchange,提问作者Vineet Gupta

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.22 15:53:12