我读了很多关于这个subjet的东西,但是我找不到一个完整的文档。我成功地使用电子打包器和电子安装程序为我的电子应用程序获得了一个setup.exe。我使用电子发布服务器创建了一个服务器来托管我要部署的电子应用程序。
我在我的电子应用程序中添加了这段轻松的代码
const autoUpdater = electron.autoUpdater;
var feedUrl = 'http://10.61.32.53:1337//download/:' + app.getVersion();
autoUpdater.setFeedURL(feedUrl);
// event handling after download new release
autoUpdater.on('update-downloaded', function (event, releaseNotes, releaseName, releaseDate, updateUrl, quitAndUpdate) {
// confirm install or not to user
var index = dialog.showMessageBox(mainWindow, {
type: 'info',
buttons: [i18n.__('Restart'), i18n.__('Later')],
title: "Typetalk",
message: i18n.__('The new version has been downloaded. Please restart the application to apply the updates.'),
detail: releaseName + "\n\n" + releaseNotes
});
if (index === 1) {
return;
}
// restart app, then update will be applied
quitAndUpdate();
} );但是当我安装我的应用程序时,我会遇到这样的错误:

事实上,我想我不知道该怎么做客户端,但服务器端也是如此。任何帮助都将不胜感激!提前感谢
发布于 2016-09-07 02:37:49
我在我的版本中使用了以下内容,并且可以正常工作(托盘图标除外):
app.on('ready', () => {
console.warn("Starting Autoupdater")
console.warn(app.getVersion())
var feedUrl = 'http://ls-desktop.herokuapp.com/update/' + os.platform() + '/' + app.getVersion() + '/';
autoUpdater.setFeedURL(feedUrl);
tray = new Tray(__dirname + '/LS.png')
console.log(__dirname + '/LS.png')
console.log('created');
autoUpdater.on('checking-for-update', function() {
tray.displayBalloon({
title: 'Autoupdater',
content: 'Checking for Update!'
})
});
autoUpdater.on('update-available', function() {
console.log("update-available");
});
autoUpdater.on('update-not-available', function() {
tray.displayBalloon({
title: 'Autoupdater',
content: 'No Updates availible!'
})
});
autoUpdater.on('update-downloaded', function() {
console.log(" update-downloaded");
});
setTimeout(function() {autoUpdater.checkForUpdates()}, 10000);
autoUpdater.on('update-downloaded', function (event, releaseNotes, releaseName, releaseDate, updateUrl, quitAndUpdate) {
var index = dialog.showMessageBox({
type: 'info',
buttons: ['Restart', 'Later'],
title: "Lornsenschule Vertretungsplan",
message: ('The new version has been downloaded. Please restart the application to apply the updates.'),
detail: releaseName + "\n\n" + releaseNotes
});
if (index === 1) {
return;
}
quitAndUpdate()
});
})请注意,我使用的setTimeout(function() {autoUpdater.checkForUpdates()}, 10000);是真正的变通方法。剩下的只是一个很好的补充,我认为
https://stackoverflow.com/questions/38749497
复制相似问题