I have a small script that captures the keyboard globally, for this I have been using node-global-key-listener. In a simple Node project the script works correctly but I need to use it from my ElectronJS (version "^16.0.7") and Vue3 application where, when accessing it, it returns the following error:
(node:1732) UnhandledPromiseRejectionWarning: Error: spawn D:\RepositoriosSlang\clienteslangGitHub\bin\WinKeyServer.exe ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
at onErrorNT (node:internal/child_process:477:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
(Use `electron --trace-warnings ...` to show where the warning was created)
(node:1732) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode).
The package use a .exe in Windows that it is not accessing correctly, that .exe is in the same node_module but it's being searched in the project root path.
Is there a difference between execute the script with node command and use it directly ?