wilix-team / iohook

Node.js global keyboard and mouse listener.
https://wilix-team.github.io/iohook
MIT License
1.2k stars 291 forks source link

iohook.node is not a valid Win32 application. #345

Closed Grayseon closed 3 years ago

Grayseon commented 3 years ago

(This is my first issue on GitHub, so sorry if I don't give enough detail)

When using IOhook with Electron, it gives me an error: iohook.node is not a valid Win32 application.

Expected Behavior

When running the application, it should output something when I press a key, or move the mouse.

Current Behavior

It errors when I only require IOhook in my index.js

Steps to Reproduce (for bugs)

  1. Install electron, and IOhook
  2. Require IOhook in the index.js
  3. Run the script with npm start (in package.json the start script runs electron . )

Context

I'm making an application where you can share mice between Windows and Mac computers.

Your Environment

Things that I have tried

328

320

https://www.electronjs.org/docs/tutorial/using-native-node-modules#using-native-node-modules

ash0x0 commented 3 years ago

Make sure to follow usage guide. I suspect you don't have the proper config for iohook in your package.json. If that's not the case, please share your entry in package.json and a full stack trace of the error.

Grayseon commented 3 years ago

For my IOhook entry it's:

"iohook": { "targets": [ "node-72", "electron-89" ], "platforms": [ "win32", "darwin" ], "arches": [ "x64", "ia32" ] }

ash0x0 commented 3 years ago

Can you provide a full stack trace? Also, are you using electron version 10?

Grayseon commented 3 years ago

image

Also I'm using Electron v13.1.6

ash0x0 commented 3 years ago

Electron 13 isn't supported yet because it has new requirements for native modules. That's why it's not working for you. When this is fixed I'll update here but for now you can use electron 12 or use an alternative library for your os.

Grayseon commented 3 years ago

Thank you for your help!