windows-installer icon indicating copy to clipboard operation
windows-installer copied to clipboard

Does not work at all

Open Andrew-web-coder opened this issue 2 years ago • 3 comments

I copy pasted the code from the docs, the result is:

SyntaxError: await is only valid in async functions and the top level bodies of modules

I deleted await and the result is:

node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
[Error: ENOENT: no such file or directory, open '\app\resources\app\package.json'] {

I do not understand why it tries to use incorrect path.

So, how to use it correctly?

Andrew-web-coder avatar Jul 08 '23 09:07 Andrew-web-coder

You need to use await

just wrap it in a function:

const electronInstaller = require('electron-winstaller');
async function e() {
try {
  await electronInstaller.createWindowsInstaller({
    appDirectory: '/tmp/build/my-app-64',
    outputDirectory: '/tmp/build/installer64',
    authors: 'My App Inc.',
    exe: 'myapp.exe'
  });
  console.log('It worked!');
} catch (e) {
  console.log(`No dice: ${e.message}`);
    }
}
e();

norbyv1 avatar Sep 04 '23 00:09 norbyv1

I suggest this be closed - @Andrew-web-coder can you do so?

belden avatar Mar 20 '24 17:03 belden

You need to use await

just wrap it in a function:

const electronInstaller = require('electron-winstaller');
async function e() {
try {
  await electronInstaller.createWindowsInstaller({
    appDirectory: '/tmp/build/my-app-64',
    outputDirectory: '/tmp/build/installer64',
    authors: 'My App Inc.',
    exe: 'myapp.exe'
  });
  console.log('It worked!');
} catch (e) {
  console.log(`No dice: ${e.message}`);
    }
}
e();

I tried it this way, and it still doesn't work

Debugger listening on ws://127.0.0.1:53850/2fa076bc-135f-4a6b-aedf-e9793d2237da For help, see: https://nodejs.org/en/docs/inspector Debugger attached. No dice: ENOENT: no such file or directory, open '/tmp/build/my-app-64/resources/app/package.json' Waiting for the debugger to disconnect...

fansOnly avatar Aug 06 '24 01:08 fansOnly