electron-找不到electron builder自动更新程序update.yml?
我现在使用的是electron-找不到electron builder自动更新程序update.yml?,electron,Electron,我现在使用的是electron builder,并设法达到了事件侦听器设置和启动的程度,但我认为我没有完全正确地设置它,就像我使用electron打开应用程序一样。,我得到了以下错误: Checking for update Cannot check for updates: Error: Error: ENOENT: no such file or directory, open 'C:\Users\Shiny\AppData\Roaming\npm\node_modules\electro
electron builder
,并设法达到了事件侦听器设置和启动的程度,但我认为我没有完全正确地设置它,就像我使用electron打开应用程序一样。
,我得到了以下错误:
Checking for update
Cannot check for updates:
Error: Error: ENOENT: no such file or directory, open
'C:\Users\Shiny\AppData\Roaming\npm\node_modules\electron\dist\resources\app-update.yml'
我确实得到了app update.yml
文件,但它被生成为:E:\Projects\3DS Files\dist\win-ia32-unpacket\resources
(这就是我的github存储库所在的位置) 如果我手动将文件放在那里,它将实际尝试并检查更新,我还没有测试它是否可以实际下载更新,但它实际上至少在尝试。 怎么了?
当其安装时,其生成为:
C:\Users\shinny\AppData\Local\Programs\3DS文件\resources
im使用的构建脚本是:
"scripts": {
"b:win": "build -w --ia32 --dir",
"p:win": "build -w --ia32"
},
"build": {
"appId": "3dsfiles",
"mac": {
"category": "3dsfiles"
},
"win": {
"publish": "github",
"iconUrl": "https://raw.githubusercontent.com/initPRAGMA/3DS-Files/master/build/icon.ico"
}
},
(您可以找到my full package.json)
b:win只是构建它,p:win将其打包到NSIS安装程序中。也许我错过了一个命令?
index.js(有趣的部分)是: 我没有将其设置为执行正确的操作或任何操作,只是一个用于调试的简单消息框,这显然不是最好的方法,但它又快又简单。
可能我缺少一些功能?最好将问题提交给electron builder项目
看起来,您正在尝试使用自动更新,而不是打包应用程序(安装后),而是直接从解包(例如从
win-ia32-unpacket
)进行自动更新。您的权利,这就是原因!谢谢当我实际安装它时,它工作正常:)
const {app, BrowserWindow, shell, dialog} = require('electron')
const {autoUpdater} = require('electron-auto-updater')
const path = require('path')
const url = require('url')
autoUpdater.addListener("update-available", function(event) {
dialog.showMessageBox({ title: "A new update is ready to install", message: `Version ${it.version} is downloaded and will be automatically installed on Quit`, buttons: ["OK"] });
});
autoUpdater.addListener("update-downloaded", function(event, releaseNotes, releaseName, releaseDate, updateURL) {
autoUpdater.quitAndInstall();
});
autoUpdater.addListener("error", function(error) {
dialog.showMessageBox({ title: "Error Happened", message: error, buttons: ["OK"] });
});
autoUpdater.addListener("checking-for-update", function(event) {
dialog.showMessageBox({ title: "Checking for update", message: `:l`, buttons: ["OK"] });
});
autoUpdater.addListener("update-not-available", function(event) {
dialog.showMessageBox({ title: "No update available", message: `:l`, buttons: ["OK"] });
});