electron / windows-installer

Build Windows Installers for Electron apps
MIT License
1.57k stars 263 forks source link

Does not work at all #477

Open Andrew-web-coder opened 1 year ago

Andrew-web-coder commented 1 year ago

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?

devnorb commented 1 year ago

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();
belden commented 6 months ago

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

fansOnly commented 2 months ago

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...