我开发了一个 Electron 应用程序并使用,eletron-packager
然后electron-squirrel-startup
我创建了.exe
安装.msi
程序文件。该.exe
文件工作正常,但.msi
不是。看起来它只是在某个时候停止并关闭。在控制面板中我可以看到“my_app Machine-Wide Installer”,我不确定这是否是预期的效果,但仍然没有安装 my_app。
我有一个非常基本的 handleSquirrelEvents 函数:
switch (squirrelEvent) {
case '--squirrel-install':
case '--squirrel-updated':
// Optionally do things such as:
// - Add your .exe to the PATH
// - Write to the registry for things like file associations and
// explorer context menus
// Install desktop and start menu shortcuts
spawnUpdate(['--createShortcut', exeName]);
setTimeout(application.quit, 1000);
return true;
case '--squirrel-uninstall':
// Undo anything you did in the --squirrel-install and
// --squirrel-updated handlers
// Remove desktop and start menu shortcuts
spawnUpdate(['--removeShortcut', exeName]);
setTimeout(application.quit, 1000);
return true;
case '--squirrel-obsolete':
// This is called on the outgoing version of your app before
// we update to the new version - it's the opposite of
// --squirrel-updated
application.quit();
return true;
}
这有点牵强,但也许它与数字签名有关?