使用 Electron-Winstaller 编译安装程序失败
Posted
技术标签:
【中文标题】使用 Electron-Winstaller 编译安装程序失败【英文标题】:Compiling an installer with Electron-Winstaller fails 【发布时间】:2022-01-18 20:48:23 【问题描述】:在尝试为我的 Electron 应用程序编译安装程序时,我收到以下错误:
Failed with exit code: 4294967295
System.Exception: Failed to compile WiX template, command invoked was: 'candle.exe -nologo -ext WixNetFxExtension -out
error CNDL0108 : The Product/@Version attribute's value, '!(bind.FileVersion.my-app.exe)', is not a valid version. Legal version values should look like 'x.x.x.x' where x is an integer from 0 to 65534.*
error CNDL0010 : The Product/@Version attribute was not found; it is required.
这是我的 build.js 文件:
var electronInstaller = require('electron-winstaller');
var settings =
appDirectory: './my-app-win32-x64',
outputDirectory: './my-app-built-installers',
authors: 'Valentin Ruiz',
version: '1.0.0',
exe: './my-app.exe'
;
resultPromise = electronInstaller.createWindowsInstaller(settings);
resultPromise.then(() =>
console.log("The installers of your application were succesfully created !");
, (e) =>
console.log(`Well, sometimes you are not so lucky: $e.message`)
);
package.json
的标题或名称中没有破折号
所以我将版本更改为 1.0.0.0 以适应 x.x.x.x 示例,但出现错误:
System.Exception: Your package version is currently 1.0.0.0, which is not SemVer-compatible, change this to be a SemVer version number
根据互联网,SemVer 编号是 X.Y.Z 布局,我不明白...
【问题讨论】:
【参考方案1】:变化:
var settings =
appDirectory: './my-app-win32-x64',
outputDirectory: './my-app-built-installers',
authors: 'Valentin Ruiz',
version: '1.0.0',
exe: './my-app.exe'
;
到这里:
var settings =
appDirectory: './my-app-win32-x64',
outputDirectory: './my-app-built-installers',
authors: 'Valentin Ruiz',
exe: './my-app.exe'
;
让它接受版本号。
【讨论】:
你的意思是把'1.0.0'
改成'1.0.0.0
?
是的,因为它说“合法版本值应该看起来像 'x.x.x.x',其中 x 是从 0 到 65534 的整数。”
现在我收到错误:System.Exception: 您的包版本当前是 1.0.0.0,不 SemVer 兼容,请将其更改为 SemVer 版本号
尝试删除版本字段,也许?以上是关于使用 Electron-Winstaller 编译安装程序失败的主要内容,如果未能解决你的问题,请参考以下文章
Electron electron-winstaller 为 Msi 设置安装路径
Electron electron-winstaller 无法为大型(文件大小)应用程序创建安装程序