我一直在尝试通过运行以下代码为带有electron-winstaller
模块的Electron应用程序创建Windows安装程序:
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 () {
const installerPath = path.join('.');
const releaseBuildsPath = path.join('..', '..', 'release-builds');
const assetsPath = path.join('..', '..', 'assets');
return Promise.resolve({
appDirectory: path.join(releaseBuildsPath, '[application name]-win32-x64'),
authors: '[my name]',
noMsi: true,
outputDirectory: installerPath,
exe: '[application name].exe',
setupExe: '[application name].exe',
setupIcon: path.join(assetsPath, 'demo.ico'),
})
}
但是,我不断收到以下错误消息:
Failed with exit code: 1
Output:
Attempting to build package from '[application name].nuspec'.
lib/net45/resources/app.asar
Stream was too long.
我运行来创建Windows软件包的脚本是这样的:
electron-packager . [application name] --overwrite --asar --platform=win32 --arch=x64 --icon=assets/demo.ico --prune=true --out=release-builds
在创建asar
存档并将prune
标志设置为true
的情况下,我看不到任何其他减小app.asar
大小的选项。太大。
我也不太了解上述错误消息中显示的lib/net45/resources/app.asar
文件的位置;我的系统(macOS Mojave)上没有名为“ lib”或“ net45”的目录。
以下是在启用调试输出的情况下运行脚本的详细结果:
electron-windows-installer:main Using Mono: 'mono' +0ms
electron-windows-installer:main Using Wine: 'wine' +2ms
electron-windows-installer:main Created NuSpec file:
electron-windows-installer:main <?xml version="1.0" encoding="utf-8"?>
electron-windows-installer:main <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
electron-windows-installer:main <metadata>
electron-windows-installer:main <id>[application name]</id>
electron-windows-installer:main <title>[application name]</title>
electron-windows-installer:main <version>1.0.0</version>
electron-windows-installer:main <authors>tg</authors>
electron-windows-installer:main <owners>tg</owners>
electron-windows-installer:main <iconUrl>https://raw.githubusercontent.com/atom/electron/master/atom/browser/resources/win/atom.ico</iconUrl>
electron-windows-installer:main <requireLicenseAcceptance>false</requireLicenseAcceptance>
electron-windows-installer:main <description>A desktop vocabulary builder app</description>
electron-windows-installer:main <copyright>Copyright © 2019 tg</copyright>
electron-windows-installer:main </metadata>
electron-windows-installer:main <files>
electron-windows-installer:main <file src="locales/**" target="lib/net45/locales" />
electron-windows-installer:main <file src="resources/**" target="lib/net45/resources" />
electron-windows-installer:main <file src="*.bin" target="lib/net45" />
electron-windows-installer:main <file src="*.dll" target="lib/net45" />
electron-windows-installer:main <file src="*.pak" target="lib/net45" />
electron-windows-installer:main <file src="*.exe.config" target="lib/net45" />
electron-windows-installer:main <file src="*.exe.sig" target="lib/net45" />
electron-windows-installer:main <file src="icudtl.dat" target="lib/net45/icudtl.dat" />
electron-windows-installer:main <file src="Squirrel.exe" target="lib/net45/squirrel.exe" />
electron-windows-installer:main <file src="LICENSE" target="lib/net45/LICENSE" />
electron-windows-installer:main <file src="[application name].exe" target="lib/net45/[application name].exe" />
electron-windows-installer:main </files>
electron-windows-installer:main </package>
electron-windows-installer:main +7s
Failed with exit code: 1
Output:
Attempting to build package from '[application name].nuspec'.
lib/net45/resources/app.asar
Stream was too long.
任何建议将不胜感激。