anasrar / node-iohook-binary

Provide iohook binary for latest electron and node js using github actions CI, just for temporary solution
12 stars 6 forks source link

Prebuild for current platform not found #2

Open dement6d opened 2 years ago

dement6d commented 2 years ago

Here's the iohook section of my package.json:

"iohook": {
    "targets": [
      "node-93"
    ],
    "platforms": [
      "win32",
      "darwin",
      "linux"
    ],
    "arches": [
      "x64",
      "ia32"
    ]
  }

Here's the output of node .\node_modules\iohook\install.js:

PS C:\Users\Cuff\Desktop\keeloger> node .\node_modules\iohook\install.js
node 93 win32 x64
Downloading prebuild for platform: iohook-v0.9.3-node-v93-win32-x64

... and 1 more

... and 1 more

... and 1 more

... and 1 more
Prebuild for current platform (iohook-v0.9.3-node-v93-linux-ia32) not found!
Try to build for your platform manually:
# cd node_modules/iohook;
# npm run build

and here's the output of running my app (node .\index.js):

refresh_locale_list [476]: GetKeyboardLayoutList(0, NULL) found 2 layouts.
refresh_locale_list [493]: Received 2 locales.
load_input_helper [866]: refresh_locale_list() found 2 locale(s).
node:internal/modules/cjs/loader:1189
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: The module '\\?\C:\Users\Cuff\Desktop\keeloger\node_modules\iohook\builds\node-v93-win32-x64\build\Release\iohook.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 99. This version of Node.js requires
NODE_MODULE_VERSION 93. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1189:18)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\Users\Cuff\Desktop\keeloger\node_modules\iohook\index.js:24:21)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
  code: 'ERR_DLOPEN_FAILED'
}
anasrar commented 2 years ago

arch ia32 not available for mac and linux, only for windows. change to more specific target

"iohook": {
  "targets": [
    {
      "target": "node",
      "abi": "93",
      "platform": "darwin",
      "arch": "x64"
    },
    {
      "target": "node",
      "abi": "93",
      "platform": "linux",
      "arch": "x64"
    },
    {
      "target": "node",
      "abi": "93",
      "platform": "win32",
      "arch": "x64"
    },
    {
      "target": "node",
      "abi": "93",
      "platform": "win32",
      "arch": "ia32"
    },
  ],
dement6d commented 2 years ago

arch ia32 not available for mac and linux, only for windows. change to more specific target

"iohook": {
  "targets": [
    {
      "target": "node",
      "abi": "93",
      "platform": "darwin",
      "arch": "x64"
    },
    {
      "target": "node",
      "abi": "93",
      "platform": "linux",
      "arch": "x64"
    },
    {
      "target": "node",
      "abi": "93",
      "platform": "win32",
      "arch": "x64"
    },
    {
      "target": "node",
      "abi": "93",
      "platform": "win32",
      "arch": "ia32"
    },
  ],

i have done this but im now stuck with "a not valid Win32 application"

anasrar commented 2 years ago

I'm not sure because I never create 32-bit application, but you can drop the 32-bit since windows 11 is not support 32-bit architecture

dement6d commented 2 years ago

I'm not sure because I never create 32-bit application, but you can drop the 32-bit since windows 11 is not support 32-bit architecture

I dont think i am trying to build for 32 bit, my Windows install is 64bit and you can see my target architecture is x64

anasrar commented 2 years ago

remove the ia32 section

"iohook": {
  "targets": [
    {
      "target": "node",
      "abi": "93",
      "platform": "darwin",
      "arch": "x64"
    },
    {
      "target": "node",
      "abi": "93",
      "platform": "linux",
      "arch": "x64"
    },
    {
      "target": "node",
      "abi": "93",
      "platform": "win32",
      "arch": "x64"
    },
-    {
-      "target": "node",
-      "abi": "93",
-      "platform": "win32",
-      "arch": "ia32"
-    },
  ],
dement6d commented 2 years ago
  "iohook": {
    "targets": [
      "node-93"
    ],
    "platforms": [
      "win32"
    ],
    "arches": [
      "x64"
    ]
  }

node .\node_modules\iohook\install.js

node 93 win32 x64
Downloading prebuild for platform: iohook-v0.9.3-node-v93-win32-x64

... and 1 more

node .\index.js

node .\index.js
refresh_locale_list [476]: GetKeyboardLayoutList(0, NULL) found 2 layouts.
refresh_locale_list [493]: Received 2 locales.
load_input_helper [866]: refresh_locale_list() found 2 locale(s).
node:internal/modules/cjs/loader:1189
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: The module '\\?\C:\Users\Cuff\Desktop\keeloger\node_modules\iohook\builds\node-v93-win32-x64\build\Release\iohook.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 99. This version of Node.js requires
NODE_MODULE_VERSION 93. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1189:18)    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\Users\Cuff\Desktop\keeloger\node_modules\iohook\index.js:24:21)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)  
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
  code: 'ERR_DLOPEN_FAILED'
}
dement6d commented 2 years ago
"iohook": {
    "targets": [
      {
        "target": "node",
        "abi": "93",
        "platform": "darwin",
        "arch": "x64"
      },
      {
        "target": "node",
        "abi": "93",
        "platform": "linux",
        "arch": "x64"
      },
      {
        "target": "node",
        "abi": "93",
        "platform": "win32",
        "arch": "x64"
      }
    ]
  }

node .\node_modules\iohook\install.js

undefined 93 darwin x64
Downloading prebuild for platform: iohook-v0.9.3-undefined-v93-darwin-x64

... and 1 more
Prebuild for current platform (iohook-v0.9.3-undefined-v93-darwin-x64) not found!Try to build for your platform manually:
# cd node_modules/iohook;
# npm run build

... and 1 more
Prebuild for current platform (iohook-v0.9.3-undefined-v93-linux-x64) not found!
Try to build for your platform manually:
# cd node_modules/iohook;
# npm run build

... and 1 more
Prebuild for current platform (iohook-v0.9.3-undefined-v93-win32-x64) not found!
Try to build for your platform manually:
# cd node_modules/iohook;
# npm run build

node .\index.js

refresh_locale_list [476]: GetKeyboardLayoutList(0, NULL) found 2 layouts.
refresh_locale_list [493]: Received 2 locales.
load_input_helper [866]: refresh_locale_list() found 2 locale(s).
node:internal/modules/cjs/loader:1189
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: The module '\\?\C:\Users\Cuff\Desktop\keeloger\node_modules\iohook\builds\node-v93-win32-x64\build\Release\iohook.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 99. This version of Node.js requires
NODE_MODULE_VERSION 93. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1189:18)    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\Users\Cuff\Desktop\keeloger\node_modules\iohook\index.js:24:21)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)  
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
  code: 'ERR_DLOPEN_FAILED'
}
dement6d commented 2 years ago
  "iohook": {
    "targets": [
      {
        "target": "node",
        "abi": "99",
-       "abi": "93",
        "platform": "darwin",
        "arch": "x64"
      },
      {
        "target": "node",
        "abi": "99",
-       "abi": "93",
        "platform": "linux",
        "arch": "x64"
      },
      {
        "target": "node",
        "abi": "99",
-       "abi": "93",
        "platform": "win32",
        "arch": "x64"
      }
    ]
  }

node .\node_modules\iohook\install.js

undefined 99 darwin x64
Downloading prebuild for platform: iohook-v0.9.3-undefined-v99-darwin-x64

... and 1 more
Prebuild for current platform (iohook-v0.9.3-undefined-v99-darwin-x64) not found!Try to build for your platform manually:
# cd node_modules/iohook;
# npm run build

... and 1 more
Prebuild for current platform (iohook-v0.9.3-undefined-v99-linux-x64) not found!
Try to build for your platform manually:
# cd node_modules/iohook;
# npm run build

... and 1 more
Prebuild for current platform (iohook-v0.9.3-undefined-v99-win32-x64) not found!
Try to build for your platform manually:
# cd node_modules/iohook;
# npm run build

node .\index.js

refresh_locale_list [476]: GetKeyboardLayoutList(0, NULL) found 2 layouts.
refresh_locale_list [493]: Received 2 locales.
load_input_helper [866]: refresh_locale_list() found 2 locale(s).
node:internal/modules/cjs/loader:1189
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: The module '\\?\C:\Users\Cuff\Desktop\keeloger\node_modules\iohook\builds\node-v93-win32-x64\build\Release\iohook.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 99. This version of Node.js requires
NODE_MODULE_VERSION 93. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1189:18)    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\Users\Cuff\Desktop\keeloger\node_modules\iohook\index.js:24:21)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)  
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
  code: 'ERR_DLOPEN_FAILED'
}
anasrar commented 2 years ago

match the ABI with your node js version currently installed on your machine

node --version
8.9.X (ABI 57)
9.2.X (ABI 59)
10.X.X (ABI 64)
11.X.X (ABI 67)
12.X.X (ABI 72)
13.X.X (ABI 79)
14.X.X (ABI 83)
15.X.X (ABI 88)
16.X.X (ABI 93)
17.X.X (ABI 102)
18.X.X (ABI 108)
dement6d commented 2 years ago

match the ABI with your node js version currently installed on your machine

I tried with abi 93, since im using node 16.15.0 but as you can see in my reply above, i get an error

anasrar commented 2 years ago

I have no idea to solve this problem, because currently not able to work with windows machine. my last recommendation is to upgrade / downgrade node or compile the binary by yourself.

dement6d commented 2 years ago

I have no idea to solve this problem, because currently not able to work with windows machine. my last recommendation is to upgrade / downgrade node or compile the binary by yourself.

I tried compiling the binary for myself, it results in the same "not valid Win32 application" error, I've made issues about it on the iohook repo. Downgrading to node 13 would work but that's not my goal, I haven't tried upgrading but i doubt that will work

txj-xyz commented 2 years ago

I've tried this as well on Node 18, this did not work as well. I was previously using Node 16.15.0

Same result, see below

Error: The module '\\?\E:\iohook-testing\node_modules\iohook\builds\node-v108-win32-x64\build\Release\iohook.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 103. This version of Node.js requires
NODE_MODULE_VERSION 108. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at Module._extensions..node (node:internal/modules/cjs/loader:1189:18)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Module._load (node:internal/modules/cjs/loader:827:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (E:\iohookshit\node_modules\iohook\index.js:24:21)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Module._load (node:internal/modules/cjs/loader:827:12) {
  code: 'ERR_DLOPEN_FAILED'
}

Node.js v18.2.0

My package.json

{
  "name": "iohook-testing",
  "version": "1.0.0",
  "description": "",
  "main": "test.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "iohook": {
    "targets": [
      "node-108",
      "electron-99"
    ],
    "platforms": [
      "win32",
      "darwin",
      "linux"
    ],
    "arches": [
      "x64",
      "ia32"
    ]
  },
  "dependencies": {
    "iohook": "^0.9.3"
  }
}
leekafai commented 1 year ago

It seems like mixed up the electron abi version & node abi version. electron v16-x matching the abi 99, but node v16-x is abi 93

refresh_locale_list [476]: GetKeyboardLayoutList(0, NULL) found 2 layouts.
refresh_locale_list [493]: Received 2 locales.
load_input_helper [866]: refresh_locale_list() found 2 locale(s).
node:internal/modules/cjs/loader:1189
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: The module '\\?\C:\Users\Cuff\Desktop\keeloger\node_modules\iohook\builds\node-v93-win32-x64\build\Release\iohook.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 99. This version of Node.js requires
NODE_MODULE_VERSION 93. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1189:18)    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\Users\Cuff\Desktop\keeloger\node_modules\iohook\index.js:24:21)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)  
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
  code: 'ERR_DLOPEN_FAILED'
}