【发布时间】:2021-10-06 13:44:46
【问题描述】:
我构建了一个启用了自动更新的电子应用程序。在 Windows 上运行应用程序后,我的应用程序发出一个错误,即“错误:找不到松鼠”。 在查看电子项目的代码以找到错误消息后。
checkForUpdates () {
const url = this.updateURL;
if (!url) {
return this.emitError(new Error('Update URL is not set'));
}
if (!squirrelUpdate.supported()) {
return this.emitError(new Error('Can not find Squirrel'));
}
this.emit('checking-for-update');
squirrelUpdate.checkForUpdate(url, (error, update) => {
if (error != null) {
return this.emitError(error);
}
if (update == null) {
return this.emit('update-not-available');
}
this.updateAvailable = true;
this.emit('update-available');
squirrelUpdate.update(url, (error) => {
if (error != null) {
return this.emitError(error);
}
const { releaseNotes, version } = update;
// Date is not available on Windows, so fake it.
const date = new Date();
this.emit('update-downloaded', {}, releaseNotes, version, date, this.updateURL, () => {
this.quitAndInstall();
});
});
});
}
然后检查函数squirrelUpdate.supported()。我知道这是因为安装位置没有文件“Update.exe”。
我使用 electron-builder 生成我的应用程序,解压后的打包目录中没有 Update.exe。如何生成Update.exe文件?
package.json中electron-builder的配置块是吹的:
"win": {
"target": [
"nsis"
],
"defaultArch": "x64",
"verifyUpdateCodeSignature": false
},
如何解决问题?谢谢。
【问题讨论】: