Я пытаюсь упаковать свое приложение Angular в Windows 10, но я получаю сообщение об ошибке и не знаю, как его исправить:
Я запускаю команду:
"package-win": "electron-packager . qlocktwo-app --overwrite --asar=true --platform=win32 --arch=ia32 --icon=src/assets/icons/win/icon.ico --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName=\"QlockTwo App\"",
Изменения, сделанные при конвертации в Электрон
index.html
Я изменил <base href="/">
на <base href="./">
электрон-main.js
const setupEvents = require('./installers/setupEvents');
if (setupEvents.handleSquirrelEvent()) {
return;
}
const {app, BrowserWindow} = require('electron');
let win;
function createWindow () {
win = new BrowserWindow({width: 800, height: 600});
win.loadFile('index.html');
win.webContents.openDevTools();
win.on('closed', () => {
win = null;
})
}
app.on('ready', createWindow);
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate', () => {
if (win === null) {
createWindow();
}
});
монтажники / setupEvents.ts
const electron = require('electron');
const app = electron.app;
module.exports = {
handleSquirrelEvent: function() {
if (process.argv.length === 1) {
return false;
}
const ChildProcess = require('child_process');
const path = require('path');
const appFolder = path.resolve(process.execPath, '..');
const rootAtomFolder = path.resolve(appFolder, '..');
const updateDotExe = path.resolve(path.join(rootAtomFolder, 'Update.exe'));
const exeName = path.basename(process.execPath);
const spawn = function(command, args) {
let spawnedProcess, error;
try {
spawnedProcess = ChildProcess.spawn(command, args, {detached: true});
} catch (error) {}
return spawnedProcess;
};
const spawnUpdate = function(args) {
return spawn(updateDotExe, args);
};
const squirrelEvent = process.argv[1];
switch (squirrelEvent) {
case '--squirrel-install':
case '--squirrel-updated':
spawnUpdate(['--createShortcut', exeName]);
setTimeout(app.quit, 1000);
return true;
case '--squirrel-uninstall':
spawnUpdate(['--removeShortcut', exeName]);
setTimeout(app.quit, 1000);
return true;
case '--squirrel-obsolete':
app.quit();
return true;
}
}
};
монтажники / окна / createinstaller.js
const createWindowsInstaller = require('electron-winstaller').createWindowsInstaller;
const path = require('path');
getInstallerConfig()
.then(createWindowsInstaller)
.catch((error) => {
console.error(error.message || error);
process.exit(1);
});
function getInstallerConfig () {
console.log('creating windows installer');
const rootPath = path.join('./');
const outPath = path.join(rootPath, 'release-builds');
return Promise.resolve({
appDirectory: path.join(outPath, 'Qlocktwo-app-win32-ia32/'),
authors: 'My Name',
noMsi: true,
outputDirectory: path.join(outPath, 'windows-installer'),
exe: 'qlocktwo-app.exe',
setupExe: 'QlockTwoApp.exe',
setupIcon: path.join(rootPath, 'src', 'assets', 'icons', 'win', 'icon.ico')
})
}
Это моя файловая структура: