我做了什么:我使用 electron-builder 打包了我的电子应用程序。我使用电子锻造打字稿和 webpack 模板来创建我的电子应用程序。
错误:在https://api.github.com/repos/OWNER/REPO/releases/assets/48643890中找不到资产“app-setup-21.6.9.exe ”
我认为问题可能与我在 github 上发布时构建文件的位置有关?
主.JS
import { app, BrowserWindow, ipcMain } from 'electron';
import { autoUpdater } from "electron-updater";
const log = require('electron-log');
declare const MAIN_WINDOW_WEBPACK_ENTRY: string;
declare const MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY: string;
const createWindow = (): void => {
// Create the browser window.
const mainWindow = new BrowserWindow({
height: 650,
width: 1200,
webPreferences: {
preload: MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY,
},
});
// and load the index.html of the app.
mainWindow.loadURL(MAIN_WINDOW_WEBPACK_ENTRY);
autoUpdater.logger = log;
log.info('App starting...');
mainWindow.once('ready-to-show', () => {
autoUpdater.checkForUpdatesAndNotify();
});
autoUpdater.on('update-available', () => {
log.info("update-available");
mainWindow.webContents.send('update_available');
});
autoUpdater.on('error', (ev, err) => {
mainWindow.webContents.send('error', err);
log.info(err);
});
autoUpdater.on('download-progress', (ev, progressObj) => {
mainWindow.webContents.send('download-progress', progressObj);
})
autoUpdater.on('update-downloaded', () => {
log.info("update_downloaded");
mainWindow.webContents.send('update_downloaded');
autoUpdater.quitAndInstall();
});
// returns repos current Version
ipcMain.on('app_version', (event) => {
log.info(app.getVersion());
mainWindow.webContents.send('app_version', { version:
app.getVersion() });
});
};
Main.js 日志
[info] App starting...
[info] Checking for update
[info] Found version 21.6.9 (url: @cloudreign/app-setup-21.6.9.exe)
[info] update-available
[info] Downloading update from @cloudapp/app-setup-21.6.9.exe
[error] Error: Error: Cannot find asset "app-setup-21.6.9.exe" in: https://api.github.com/repos/<OWNER>/<REPO>/releases/assets/48643890"