Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iohook build different node js version #420

Open
Deliver88 opened this issue Dec 25, 2022 · 15 comments
Open

iohook build different node js version #420

Deliver88 opened this issue Dec 25, 2022 · 15 comments

Comments

@Deliver88
Copy link

I built the iohook repo and used it in a electron app ending with this issue:

NODE_MODULE_VERSION 93. This version of Node.js requires NODE_MODULE_VERSION 107. Please try re-compiling or re-installing

I am using Electron version: 20.3.7 and Node js version: 16.15.0. I built the iohook with node js version 16.15.0. As I understood, there is no electron version with node_module_version 93, or a node js module version 107. Is there a workaround?

Thanks.

@nightincode
Copy link

I just spent 2 days trying to do the same. Here is the fix for your issue:

https://www.electronjs.org/docs/latest/tutorial/using-native-node-modules follow the 3rd code block instructions (the one with export commands). Apply all of these (the first export is the ELECTRON version).

npm run build will do the job or you can use electron-rebuild. Both work. You might run into an issue relating to the NAN libary, this is a known bug and the patch is out there. Once you patch it, it builds correctly (google the error). I have a working build for Mac & Linux for electron 22.1.0 (ABI 110) in combination with Node 16.18.1

The error you are seeing is because the npm is not setup correctly and its linking against the node, it needs the electron.

@Deliver88
Copy link
Author

Hello @nightincode , thank you very much! I will try it.

@harismuha123
Copy link

@nightincode do you mind sharing the prebuilt .tar.gz file if you have it by any chance? I'm using your approach but it isn't really working for a project with Electron 22.

@nightincode
Copy link

nightincode commented Jun 13, 2023 via email

@harismuha123
Copy link

harismuha123 commented Jun 13, 2023

@nightincode MacOS 13.4 (22F66) with ARM64 M1, version 22.0.0, ABI 110 (darwin-arm64)

@harismuha123
Copy link

@nightincode iohook 0.9.3

@nightincode
Copy link

here you go buddy :) for linux/windows/mac all tested

https://github.com/nightincode/iohook-bins/blob/main/prebuild_libs.zip

(Also includes patched source)

@harismuha123
Copy link

@nightincode hvala :) you have saved my life with this 😄

@nightincode
Copy link

Next time you have an issue like this, try my ChatGPT powered plugin to help you solve your issue: shuto.io (now available on the chatGPT plugin store)! You are welcome 👍

@harismuha123
Copy link

@nightincode do you have an ARM64 prebuilt version perhaps? getting the following with this:
Error: dlopen(/Users/chern0/Code/droplr-desktop-v2/src/main/custom-packages/iohook/darwin/build/Release/iohook.node, 0x0001): tried: '/Users/chern0/Code/droplr-desktop-v2/src/main/custom-packages/iohook/darwin/build/Release/iohook.node' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/chern0/Code/droplr-desktop-v2/src/main/custom-packages/iohook/darwin/build/Release/iohook.node' (no such file), '/Users/chern0/Code/droplr-desktop-v2/src/main/custom-packages/iohook/darwin/build/Release/iohook.node' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))

@nightincode
Copy link

You have arm based cpu, you need to rebuild it with the source that is there

@nightincode
Copy link

The source code for mac (the patched mac version) is now also available as a zip in the same repo
https://github.com/nightincode/iohook-bins

@ferothefox
Copy link

Hi @nightincode, can you be a bit more specific than "google the issue"? I've downloaded your repo and I'm able to build a node v18 version, but can't figure out getting Electron 25 for windows and mac to build. I'm on Windows 11 and followed the docs, but still can't figure it out.

npm ERR! code EOVERRIDE
npm ERR! Override for nan@^2.15.0 conflicts with direct dependency

Adding a package.json override to patch the AccessorSignature bug creates that error, and I can't build electron still. Any help would be greatly appreciated.

@harismuha123
Copy link

@ferothefox I used the code @nightincode provided to patch iohook and create a new repo that works well with Electron 22 and Node 18: https://github.com/Droplr/iohook-v2. Hope you are able to do the same for 25 on your machine.

@ferothefox
Copy link

ferothefox commented Jul 19, 2023

@harismuha123 Hey Haris, yes, I was able to get it to work on Electron 25! I have a repo here, complete with cross platform builds powered by GitHub Actions. I might retroactively build all of the other major versions, but for now this works for my purposes. The repo is here https://github.com/robolab-io/iohook

For anyone seeing this in the future, if you need a version of iohook built for Electron 25 and Node 18, please check out this release: https://github.com/robolab-io/iohook/releases/tag/v0.9.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants