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

Iconv mode issue #141

Closed creaz35 closed 2 years ago

creaz35 commented 2 years ago

Hi Guys,

I tried everyhting but i can't make it work. See below.

I have removedn ode_modules also and run npm i again without success, i also tried npm rebuild.

node:20140) UnhandledPromiseRejectionWarning: Error: The module '\?\C:\Users\Brian\Desktop\projects\app-desktop\node_modules\ref-wchar-napi\node_modules\iconv\build\Release\iconv.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 93. This version of Node.js requires NODE_MODULE_VERSION 106. Please try re-compiling or re-installing the module (for instance, using npm rebuild or npm install).

Code:

const activeWindowPage = require('active-win');

`function displayActiveWin() {

(async () => {
    var options = [];
    console.log(await activeWindowPage(options));
    /*
    {
        title: 'Unicorns - Google Search',
        id: 5762,
        bounds: {
            x: 0,
            y: 0,
            height: 900,
            width: 1440
        },
        owner: {
            name: 'Google Chrome',
            processId: 310,
            bundleId: 'com.google.Chrome',
            path: '/Applications/Google Chrome.app'
        },
        url: 'https://sindresorhus.com/unicorn',
        memoryUsage: 11015432
    }
    */
})();

}`

setInterval(displayActiveWin, 5*1000);
creaz35 commented 2 years ago

λ node -v v16.15.1

sindresorhus commented 2 years ago

This is a problem with the iconv dependency. Try opening a question there instead.

creaz35 commented 2 years ago

Hi sindresorhus,

Thanks i understand but i went to the github and it says support node 12. So we cannot use activewin if we have > 12 for node?

Thanks!

ref-wchar-napi A ref "type" implementation of wchar_t * (a.k.a. wide string) backed by "node-iconv" Build Status Build Status

This module offers a "wide strings" (wchar_t *) implementation on top of Node.js Buffers using the ref "type" interface. Supports Node 6, 7, 8, 10, 12.

Jannchie commented 2 years ago

@creaz35 I Fixed this problem by build node-iconv locally and replace all the files in Release folder.