Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work at all #477

Open
Andrew-web-coder opened this issue Jul 8, 2023 · 3 comments
Open

Does not work at all #477

Andrew-web-coder opened this issue Jul 8, 2023 · 3 comments

Comments

@Andrew-web-coder
Copy link

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
Copy link

devnorb commented Sep 4, 2023

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
Copy link

belden commented Mar 20, 2024

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

@fansOnly
Copy link

fansOnly commented Aug 6, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants