ElectronJS autoupdater.setFeedURL() 抛出异常 ["Update check failed. The server sent an invalid response. Try again later."]

ElectronJS autoupdater.setFeedURL() throw exception ["Update check failed. The server sent an invalid response. Try again later."]

我正在使用电子开发桌面应用程序,一切正常,除了 autoUpdater.setFeedURL() 方法,它 returns 总是这个异常:“更新检查失败。服务器发送无效响应。请稍后重试。“

if(!isDev)
    {
      autoUpdater.setFeedURL({
        "url":"https://github.com/MyUsername/MyRepos/releases/"
      });
      autoUpdater.checkForUpdates();
    }

enter image description here

是啊!经过 2 天的头痛之后,我发现我只是在使用一个已弃用的 autoUpdater 版本,我应该使用这个 :

const { autoUpdater } = require('electron-updater');

所以我接下来要做的就是删除 setFeedURL 行而不是 autoUpdater.checkForUpdates() 我用了 autoUpdater.checkForUpdatesAndNotify()

if(!isDev)
{
    autoUpdater.checkForUpdatesAndNotify();
}