“如何修复”;跳过CheckForUpdates和Notify,因为应用程序未打包;在electron.js中
我正在使用“electron updater”检查是否自动更新electron应用程序 调用“checkForUpdatesAndNotify()”函数 在控制台中,我得到“跳过checkForUpdatesAndNotify,因为应用程序未打包”“如何修复”;跳过CheckForUpdates和Notify,因为应用程序未打包;在electron.js中,electron,auto-update,electron-builder,Electron,Auto Update,Electron Builder,我正在使用“electron updater”检查是否自动更新electron应用程序 调用“checkForUpdatesAndNotify()”函数 在控制台中,我得到“跳过checkForUpdatesAndNotify,因为应用程序未打包” 莫哈韦 “电子更新程序”:“^4.0.6” “电子”:“^3.0.13” “electron builder”:“20.28.1” 检查更新和通知()在开发模式下无法工作 如果您坚持在开发模式下测试它,您可以使用isPackaged: const
- 莫哈韦
- “电子更新程序”:“^4.0.6”
- “电子”:“^3.0.13”
- “electron builder”:“20.28.1”
检查更新和通知()
在开发模式下无法工作
如果您坚持在开发模式下测试它,您可以使用isPackaged
:
const-app=require('electron')。app;
Object.defineProperty(应用程序“iPackaged”{
得到(){
返回true;
}
});
请小心,不要将此黑客用于生产,它可能会使用
自动更新程序。请检查更新,您在哪个环境中面临此问题,是开发还是生产?
const {autoUpdater} = require("electron-updater");
autoUpdater.checkForUpdatesAndNotify();
autoUpdater.on('checking-for-update', () => {
console.log('Checking for update...');
});
autoUpdater.on('update-available', (info) => {
console.log('Update available.');
});
autoUpdater.on('update-not-available', (info) => {
console.log('Update not available.');
});
autoUpdater.on('error', (err) => {
console.log('Error in auto-updater. ' + err);
});
autoUpdater.on('download-progress', (progressObj) => {
let log_message = "Download speed: " + progressObj.bytesPerSecond;
log_message = log_message + ' - Downloaded ' + progressObj.percent + '%';
log_message = log_message + ' (' + progressObj.transferred + "/" + progressObj.total + ')';
console.log(log_message);
});
autoUpdater.on('update-downloaded', (info) => {
console.log('Update downloaded');
});