为什么Electron autoUpdate找不到新版本?

问题描述

我有一个Electron应用程序,并且实现了一个类来自动更新自身。

const nutsURL = 'https://myapp.update.server/update/win32/${appVersion}'
    
function init(mainWindow) {
  if (initialized || !updateFeed || process.env.NODE_ENV === 'development') { return }

  initialized = true
  autoUpdater.setFeedURL(updateFeed)

  autoUpdater.on('error',(ev,err) => {
    mainWindow.webContents.send('message','Error: ' + err)
  })

  autoUpdater.once('checking-for-update','Checking for updates')
  })

  autoUpdater.once('update-available','Update available. Downloading ⌛️')
  })

  autoUpdater.once('update-not-available','Update not available,starting...')
  })

  autoUpdater.once('update-downloaded',err) => {
    setTimeout(function() {
      autoUpdater.quitAndInstall()
    },2000)
    mainWindow.webContents.send('message','Update downloaded - Restarting')
  })

  setTimeout(function() {
    autoUpdater.checkForUpdates()
  },3000)
}

具有appVersion 0.0.1的端点将返回如下内容(并且下载链接有效):

{"url":"http://myapp.update.server/download/version/0.0.2/windows_32?filetype=zip","name":"0.0.2","notes":"","pub_date":"2020-11-12T21:03:37.000Z"}

但是应用程序始终会通过以下消息返回错误

Error: AutoUpdater process with arguments --checkForUpdate,https://myapp.update.server/update/win32/0.0.1 is already running

有人可以帮助我吗?为什么应用程序找不到最新版本?为什么总是返回错误而不返回'update-not-available'事件?

我正在服务器上运行Nuts,以提供更新。 https://github.com/GitbookIO/nuts

谢谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)