sindresorhus / get-windows

Get metadata about the active window and open windows (title, id, bounds, owner, etc)
MIT License
783 stars 161 forks source link

Not Working On windows (before exe and after exe both) #136

Closed basantsd closed 2 years ago

basantsd commented 2 years ago

it's working on mac but when i install active win and excute then i got this error :

setInterval(async () => {
      const window = await activeWindow().catch((error) => console.log(error));
      console.log(window);
   }, 4000);

(node:14324) UnhandledPromiseRejectionWarning: Error: The module '\?\C:\Users\xxxxxxx\Desktop\project1\yy\node_modules\iconv\build\Release\iconv.node' NODE_MODULE_VERSION 102. This version of Node.js requires NODE_MODULE_VERSION 101. Please try re-compiling or re-installing the module (for instance, using npm rebuild or npm install). at process.func [as dlopen] (node:electron/js2c/asar_bundle:5:1800) at Object.Module._extensions..node (node:internal/modules/cjs/loader:1199:18) at Object.func [as .node] (node:electron/js2c/asar_bundle:5:1800) at Module.load (node:internal/modules/cjs/loader:988:32) at Module._load (node:internal/modules/cjs/loader:829:12) at Function.c._load (node:electron/js2c/asar_bundle:5:13331) at Module.require (node:internal/modules/cjs/loader:1012:19) at require (node:internal/modules/cjs/helpers:102:18) at Object. (C:\Users\ xxxxxxx\Desktop\project1\yy\node_modules\iconv\lib\iconv.js:27:14) at Module._compile (node:internal/modules/cjs/loader:1116:14) (Use electron --trace-warnings ... to show where the warning was created) (node:14324) 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). (rejection id: 1)

basantsd commented 2 years ago

When I generated .exe by macOS and I Facing the same issue https://github.com/sindresorhus/active-win/issues/112. After installing .exe generated by - "electron-builder --win --x64" it is giving me ".tmp.node is not a valid Win32 application".

jove0610 commented 2 years ago

I had the same issue when iconv module is asking for different node version. I installed and used electron-builder and it fixed my problem.

basantsd commented 2 years ago

I had the same issue when iconv module is asking for different node version. I installed and used electron-builder and it fixed my problem.

which node version you use ? please explain in detail. i still facing same problem.

jove0610 commented 2 years ago

Sorry, I meant electron-rebuild.

npm install --save-dev electron-rebuild

// run this
.\node_modules\.bin\electron-rebuild.cmd

That's all I did.

basantsd commented 2 years ago

Thanks #jove0610 now it's working, but what about urls in windows and some mac system also not return active window urls.