electron-userland / electron-wix-msi

:dvd: Create traditional MSI installers for your Electron app
MIT License
318 stars 91 forks source link

light.exe : error LGHT0306 : An error (E_FAIL) was returned while finalizing a CAB file. #184

Open turalowski opened 4 months ago

turalowski commented 4 months ago

Hello,

When I try to create msi installer for electron application with electron-wix-msi package, following error message appears:

                throw new Error(`Could not create ${type} file. Code: ${code} StdErr: ${stderr} StdOut: ${stdout}`);
                      ^

Error: Could not create msi file. Code: 306 StdErr:  StdOut: Windows Installer XML Toolset Linker version 3.14.1.8722
Copyright (c) .NET Foundation and contributors. All rights reserved.

light.exe : error LGHT0306 : An error (E_FAIL) was returned while finalizing a CAB file. This most commonly happens when creating a CAB file with more than 65535 files in it. Either reduce the number of files in your installation package or split your installation package's files into more than one CAB file using the Media element.

How can I create multiple CAB files?

build.js

const { MSICreator } = require('electron-wix-msi');
const fse = require('fs-extra');

const path = require('path')

module.exports.build = async (conf) => {
  let remove = conf.remove
  for (let file_path of remove) {
    fse.removeSync(file_path);
  }
  fse.removeSync(
    path.resolve(
      conf.src, 'resources', 'app', 'node_modules', '.cache'
    )
  )

  const options = {
    ...
  }
  fse.ensureDirSync(conf.dist);

  const msiCreator = new MSICreator(options);

  await msiCreator.create();
  await msiCreator.compile();
}