get-windows
get-windows copied to clipboard
Cannot find module ffi-napi on Windows 11
this is what it shows if I run node index.js
(codes from the docs)
node:internal/modules/cjs/loader:933
const err = new Error(message);
^
Error: Cannot find module 'ffi-napi'
Require stack:
- C:\Users\admin\Desktop\PROJECTS\test\node_modules\active-win\lib\windows.js
- C:\Users\admin\Desktop\PROJECTS\test\node_modules\active-win\index.js
- C:\Users\admin\Desktop\PROJECTS\test\index.js
←[90m at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)←[39m
←[90m at Function.Module._load (node:internal/modules/cjs/loader:778:27)←[39m
←[90m at Module.require (node:internal/modules/cjs/loader:1005:19)←[39m
←[90m at require (node:internal/modules/cjs/helpers:102:18)←[39m
at Object.<anonymous> (C:\Users\admin\Desktop\PROJECTS\test\node_modules\←[4mactive-win←[24m\lib\windows.js:4:13)
←[90m at Module._compile (node:internal/modules/cjs/loader:1105:14)←[39m
←[90m at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)←[39m
←[90m at Module.load (node:internal/modules/cjs/loader:981:32)←[39m
←[90m at Function.Module._load (node:internal/modules/cjs/loader:822:12)←[39m
←[90m at Module.require (node:internal/modules/cjs/loader:1005:19)←[39m {
code: ←[32m'MODULE_NOT_FOUND'←[39m,
requireStack: [
←[32m'C:\\Users\\admin\\Desktop\\PROJECTS\\test\\node_modules\\active-win\\lib\\windows.js'←[39m,
←[32m'C:\\Users\\admin\\Desktop\\PROJECTS\\test\\node_modules\\active-win\\index.js'←[39m,
←[32m'C:\\Users\\admin\\Desktop\\PROJECTS\\test\\index.js'←[39m
]
}
this is on my co-worker's PC who uses Windows 11. In my PC (Windows 10) I do not encounter any problem so we assume this is specific to Windows 11. We used the same node version (v16.15.1).
the code I'm running was exactly the one in the docs:
const activeWindow = require('active-win');
(async () => {
console.log(await activeWindow());
})();
I had the same issue on Windows 11 using node v16.16.0. Switching from active-win 7.6.1
to 7.7.2
solved the issue for me.
Did you get to resolve this