问题描述
我对电子应用程序的自动更新有问题, 在我完成所有应用程序部分并尝试将其推送到我的自定义更新服务器后,我在我的记录器中发现了此错误消息:
Error unkNown ENOENT: no such file or directory,open
'C:\{appPath}\{appName}\resources\app-update.yml'
这是我的 package.json 构建配置
"build": {
"appId": "com.server.app","copyright": "copyright company name","generateUpdatesFilesForAllChannels": true,"win": {
"target": "nsis","icon": "build/icon.ico"
},"mac": {
"target": "dmg","artifactName": "appName.dmg","icon": "build/icon.icns"
},"dmg": {
"background": "build/i-bg.tif","icon": "build/setup.icns","iconSize": 80,"title": "${productName}-${version}","window": {
"width": 540,"height": 380
}
},"nsis": {
"artifactName": "${productName}-Setup-${version}.${ext}","oneClick": false,"perMachine": false,"allowtochangeInstallationDirectory": true,"installerIcon": "build/setup.ico","uninstallerIcon": "build/setup.ico","installerHeader": "build/installerHeader.bmp","installerSidebar": "build/installerSidebar.bmp","runAfterFinish": true,"deleteAppDataOnUninstall": true,"createDesktopShortcut": "always","createstartmenuShortcut": true,"shortcutName": "AppName","publish": [{
"provider": "generic","url": "https://my-update-server/path"
}]
},"extraFiles": [
"data","templates"
]
},"publish": [{
"provider": "generic","url": "https://my-update-server/path"
}],
//-----------------------------------------------
// Auto-Update event listening
//-----------------------------------------------
autoUpdater.on('checking-for-update',() => {
splashLoadingStatus(`Checking for ${appName} update ...`);
})
autoUpdater.on('update-available',(info) => {
splashLoadingStatus(`${appName} new update available.`);
})
autoUpdater.on('update-progress',(progInfo) => {
splashLoadingStatus(`Download speed: ${progInfo.bytesPerSecond} - Download ${progInfo.percent}% (${progInfo.transferred}/${progInfo.total})`);
})
autoUpdater.on('error',(error) => {
dialog.showErrorBox('Error',error.message);
})
autoUpdater.on('update-downloaded',(info) => {
const message = {
type: 'info',buttons: ['Restart','Update'],title: `${appName} Update`,detail: `A new version has been downloaded. Restart ${appName} to apply the updates.`
}
dialog.showMessageBox(message,(res) => {
if(res === 0) {
autoUpdater.quitAndInstall();
}
})
})
.....
autoUpdater.setFeedURL('https://my-update-server/path');
autoUpdater.checkForUpdatesAndNotify();
.....
然后,当我推送构建时,它会在生成 latest.yml 文件的情况下做所有正确的事情,但是在安装后我发现 app-update.yml 不在那里......
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)