electron-userland / electron-builder

A complete solution to package and build a ready for distribution Electron app with “auto update” support out of the box
https://www.electron.build
MIT License
13.57k stars 1.73k forks source link

Error: Invalid major number number in: <version> #7789

Closed james-pre closed 4 months ago

james-pre commented 11 months ago
Error: Invalid major number in: alpha-1.4.4
    at AppInfo.getVersionInWeirdWindowsForm (<project-root>\node_modules\app-builder-lib\src\appInfo.ts:83:13)
    at WinPackager.signAndEditResources (<project-root>\node_modules\app-builder-lib\src\winPackager.ts:294:46)
    at <project-root>\node_modules\app-builder-lib\src\winPackager.ts:386:21
james-pre commented 11 months ago

Research:

The error is thrown by appInfo.getVersionInWeirdWindowsForm() in WinPackager.ts:

appInfo.shortVersionWindows || appInfo.getVersionInWeirdWindowsForm(),

Since it won't be called if appInfo.shortVersionWindows is set, it would be beneficial if that could be set by the user. In the AppInfo constructor, shortVersionWindows is set like so:

if (info.metadata.shortVersionWindows) {
    this.shortVersionWindows = info.metadata.shortVersionWindows
}

This means the user needs to be able to set the metadata.shortVersionWindows of the Packager instance passed to the AppInfo constructor (as info).

The AppInfo instance is created by Packager in its _build method:

this._appInfo = new AppInfo(this, null)

Packager assigns to its metadata like so:

deepAssign(this.metadata, configuration.extraMetadata)

So it should be possible to pass shortVersionWindows to extraMetadata.

james-pre commented 11 months ago

The build fails with this command:

<user>\AppData\Local\electron-builder\Cache\winCodeSign\winCodeSign-2.6.0\rcedit-x64.exe' '\dist\win-unpacked\<app name>-client.exe' --set-version-string FileDescription '<app name> Client' --set-version-string ProductName '<app name> Client' --set-version-string LegalCopyright '<copyright>' --set-file-version <version> --set-product-version <version> --set-version-string InternalName <app name>-client --set-version-string OriginalFilename '' --set-version-string CompanyName 'Dr. Vortex' --set-icon '<project>\dist\.icon-ico\icon.ico

and the error: Fatal error: Unable to parse version string for FileVersion

Looking at the output, the error is caused by these 2 flags:

--set-file-version <version>
--set-product-version <version>

Which I presume is because <version> looks like string-1.2.3. Is it possible to use a version like that?

github-actions[bot] commented 9 months ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] commented 4 months ago

This issue was closed because it has been stalled for 30 days with no activity.