electron-wix-msi icon indicating copy to clipboard operation
electron-wix-msi copied to clipboard

not know how to run below code

Open HelloWorldCAT opened this issue 7 years ago • 3 comments

don't know how to use this to generator an msi .

import { MSICreator } from 'electron-wix-msi';

// Step 1: Instantiate the MSICreator
const msiCreator = new MSICreator({
  appDirectory: '/path/to/built/app',
  description: 'My amazing Kitten simulator',
  exe: 'kittens',
  name: 'Kittens',
  manufacturer: 'Kitten Technologies',
  version: '1.1.2',
  outputDirectory: '/path/to/output/folder'
});

// Step 2: Create a .wxs template file
await msiCreator.create();

// Step 3: Compile the template to a .msi file
await msiCreator.compile();

HelloWorldCAT avatar Feb 09 '18 03:02 HelloWorldCAT

I assume like this:

  • create a new file (i.e., .js) in your electron project folder and paste in the code
  • open a terminal and cd into your electron project folder
  • run node <the_name_of_the_file_you_just_created>

But, I think you need to transpile your code first.

mihaiconstantin avatar Mar 11 '18 01:03 mihaiconstantin

Hi, I am new to nodejs and Electron. I have created my app build with electron packager and wanted to create the msi file of the application. I transpile my code like this

`'use strict';

var _electronWixMsi = require('electron-wix-msi');

// Step 1: Instantiate the MSICreator var msiCreator = new _electronWixMsi.MSICreator({ appDirectory: '/path/to/built/app', description: 'My amazing Kitten simulator', exe: 'kittens', name: 'Kittens', manufacturer: 'Kitten Technologies', version: '1.1.2', outputDirectory: '/path/to/output/folder' });

// Step 2: Create a .wxs template file await msiCreator.create();

// Step 3: Compile the template to a .msi file await msiCreator.compile();`

but when I run the code using node mycode,js through the terminal I am getting this error.

await msiCreator.create(); SyntaxError: await is only valid in async function at createScript (vm.js:80:10) at Object.runInThisContext (vm.js:139:10) at Module._compile (module.js:616:28) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) at Function.Module.runMain (module.js:693:10) at startup (bootstrap_node.js:188:16) at bootstrap_node.js:609:3

vaibhav6233m avatar Mar 22 '18 09:03 vaibhav6233m

    async function createMSI() {
        await msiCreator.create();
        await msiCreator.compile();
    }

    createMSI().then(() => {
        // Success
    }, (e) => {
        // Fail
    });

markmorris avatar Oct 17 '18 21:10 markmorris