Lil*_*eau 5 nsis electron electron-updater
Electron updater 4.2.0 软件包无法下载新版本,但可以检测到它
这是 github 上的私人存储库
新版本已成功发送到github
在package.json中:
"build": {
"appId": "com.myApp.ID",
"npmRebuild": false,
"win": {
"icon": "./resources/electron/icons/256x256.png",
"publish": [
{
"provider": "github",
"owner": "me",
"repo": "POS",
"private": true,
"releaseType": "release",
"token": "<private token>"
}
],
"target": [
{
"target": "nsis",
"arch": [
"x64"
]
}
]
}
},
Run Code Online (Sandbox Code Playgroud)
我的 electro.js 文件或 main.js 我有:
win.webContents.on('did-finish-load', () => {
if(!serve) {
appUpdater(win);
}
});
Run Code Online (Sandbox Code Playgroud)
appUpdater函数是:
function appUpdater(win) {
autoUpdater.autoInstallOnAppQuit = true;
autoUpdater.autoDownload = true;
autoUpdater.logger = logger;
/* Log whats happening
TODO send autoUpdater events to renderer so that we could console log it in developer tools
You could alsoe use nslog or other logging to see what's happening */
let foundUpdate = false;
autoUpdater.on('checking-for-update', () => {
dialog.showMessageBox(win, {
message: 'CHECKING FOR UPDATES !!'
});
});
autoUpdater.on('update-available', () => {
foundUpdate = true;
dialog.showMessageBox(win, {
message: ' update-available !!'
});
});
autoUpdater.on('error', error => {
autoUpdater.logger.debug(error);
});
// Ask the user if update is available
autoUpdater.on('update-downloaded', (_event, releaseNotes, _releaseName) => {
let message = 'A new version is now available. It will be installed the next time you restart the application.';
dialog.showMessageBox(win, {
type: 'question',
buttons: ['Install', 'Later'],
defaultId: 0,
message: 'A new version has been downloaded',
detail: message
}, response => {
if(response === 0) {
setTimeout(() => autoUpdater.quitAndInstall(), 1);
}
});
});
// init for updates
setInterval(() => {
if(!foundUpdate) {
autoUpdater.checkForUpdates();
}
}, 60000);
}
exports.appUpdater = appUpdater;
Run Code Online (Sandbox Code Playgroud)
我从自动更新程序中获取记录
自动更新目标是windows nsis
检查更新和更新可用事件正确触发,但更新下载或错误根本不触发
如果您已经有这方面的经验,请告诉我
注意:我也在用户计算机中设置了环境变量 GH_TOKEN
现在比以前更好了,我在 mac bigSur 的新更新中苦苦挣扎,因为 electro-builder@^20.38.0 给了我非常严重的错误!所以我决定更新到最新版本
electron: ^12.0.2
electron-builder: ^22.10.5
electron-updater: ^4.3.8
Run Code Online (Sandbox Code Playgroud)
它一开始不起作用,给我这样的错误: Cannot download Differential, Fallback to full download: Error: Maximum allowed size is 50 MB。
最后我的节点版本是 v10.15.1 本地我更新到 v14.16.0 现在它可以工作了!
使用其他版本更新和降级的另一个问题是下载但安装失败。
| 归档时间: |
|
| 查看次数: |
5170 次 |
| 最近记录: |