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 not found with Electron #245

Closed
PiggyPlex opened this issue Jul 12, 2020 · 18 comments
Closed

iohook not found with Electron #245

PiggyPlex opened this issue Jul 12, 2020 · 18 comments
Labels
awaiting feedback Waiting on an answer or information from issue or PR author to proceed windows Windows related issues, includes WSL and MSYS

Comments

@PiggyPlex
Copy link

Expected Behavior

iohook should work. Would like to use iohook in the front-end however cannot get it to work.

Current Behavior

image
Tried generating ABIs for both NodeJS and Electron and added sufficient parts to package.json. Have tried uninstalling, reinstalling, using https://www.electronjs.org/docs/tutorial/using-native-node-modules. Read multiple bug reports and articles and watched videos all to no avail. I believe it might be to do with Electron running a separate runtime version, however I've even tried editing the code to require the file by its absolute path and that still does not work.

Possible Solution

Steps to Reproduce (for bugs)

  1. Install iohook using NPM (npm i iohook -s)
  2. Run Electron (electron .)
const electron = require('electron'),
          iohook = require('iohook');

Context

Trying to do keystroke and mouse detection for an on-screen counter in Electron.

Your Environment

  • Version used: v0.6.6
  • Environment name and version (e.g. Chrome 39, node.js 5.4): Node.JS v11.10.1; Electron v9.1.0
  • Operating System and version (desktop or mobile): Desktop (Windows 10)
  • package.json:
  "iohook": {
    "targets": [
      "node-67",
      "electron-80"
    ],
    "platforms": [
      "win32",
      "darwin",
      "linux"
    ],
    "arches": [
      "x64",
      "ia32"
    ]
  }
@marcelblum
Copy link
Contributor

marcelblum commented Jul 13, 2020

iohook does not yet work with Electron 9 on Windows and 0.6.6 failed to achieve compatibility, see #241. On Windows for iohook to work currently you must use Electron <9.

@PiggyPlex
Copy link
Author

Still get the same issue after downgrading to Electron 8.3.4 despite someone saying that works in the post.

@marcelblum
Copy link
Contributor

For Electron 8.3.4 your package json should now have
"targets": [ "electron-76", "node-72" ]
for Electron 8 and Node 12. Node 12.13.0 is the one paired with Electron 8.3.4. Unless you are intentionally using a different Node version with your Electron setup (you mentioned Node.JS v11.10.1 above)?

@ghmendonca
Copy link

ghmendonca commented Jul 14, 2020

I am using node 12.13.0, iohook 0.6.6 and electron 8.3.4 on windows and doesn't work, I get the same error saying the module was not found even the module is there. I tried adding the targets to my package json and still doesn't work.

Any idea why it doesn't work?

@PiggyPlex
Copy link
Author

Node.JS v11.10.1 is working with Electron and is not the issue.

@PiggyPlex
Copy link
Author

Unless there are features in v12 which iohook utilises which causes an error, however it seems unlikely.

@ghmendonca
Copy link

Just checked with node v11.10.1 and doesn't work as well :/

@akbar-animaker
Copy link

any update on this... i am facing the same issue

@zxc23
Copy link

zxc23 commented Jul 25, 2020

An update: I've had multiple confirmations that this problem was resolved by installing Microsoft Visual C++ Redistributable on the machines via https://support.microsoft.com/en-au/help/2977003/the-latest-supported-visual-c-downloads.

These issues are all related:

#55
#167
#193
#195
#224
#245

@danikoala
Copy link

What about Mac users? Right after I call require('iohook'), my electron process stops:

Process exited with code 0

I'm using electron 9.1.2

@PiggyPlex
Copy link
Author

I've reinstalled Microsoft Visual C++ Redistributable and reinstalled iohook with no avail.

@messerbill
Copy link

@marcelblum thank you very much....no docs where telling that stuff in that explicit form like you did.

@PiggyPlex
Copy link
Author

Any update?

@marcelblum
Copy link
Contributor

@PiggyPlex lot of updates to iohook since you originally posted, have you tried the latest version, which now works through latest Electron v11.x?

@Djiit Djiit added awaiting feedback Waiting on an answer or information from issue or PR author to proceed windows Windows related issues, includes WSL and MSYS labels Feb 5, 2021
@joaomendoncaa
Copy link

@marcelblum I'm having the same issue...

Error: Cannot find module 'D:\myprojects\full-projects\bindbox\node_modules\iohook\builds\electron-v85-win32-x64\build\Release\iohook.node'

Any feedback on this issue?

@zhouyi19980603
Copy link

@marcelblum I'm having the same issue...

Error: Cannot find module 'D:\myprojects\full-projects\bindbox\node_modules\iohook\builds\electron-v85-win32-x64\build\Release\iohook.node'

Any feedback on this issue?

你解决了吗

@joaomendoncaa
Copy link

@marcelblum I'm having the same issue...
Error: Cannot find module 'D:\myprojects\full-projects\bindbox\node_modules\iohook\builds\electron-v85-win32-x64\build\Release\iohook.node'
Any feedback on this issue?

你解决了吗

No, i had to use an older version of electron and electron-rebuild package.

@ash0x0
Copy link
Collaborator

ash0x0 commented Jun 11, 2021

Closing as irrelevant.

@ash0x0 ash0x0 closed this as completed Jun 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting feedback Waiting on an answer or information from issue or PR author to proceed windows Windows related issues, includes WSL and MSYS
Projects
None yet
Development

No branches or pull requests