Comments (54)
Try this.
https://www.youtube.com/watch?v=6o9xybTYlLU
For audio : https://app.box.com/s/6gusokl3srmj85iyohavoyjvwmesfapg
from iohook.
Hm, it's simple to solve.
For example, if you have error like this
Error: Cannot find module '../node_modules/iohook/builds/electron-v75-darwin-x64/build/Release/iohook.node'
See part of error message electron-v75-darwin-x64
, put their to package.json
"iohook": {
"targets": [
"electron-75"
],
"platforms": [
"darwin"
],
"arches": [
"x64"
]
}
and install iohook
again
npm i -S iohook
That it's.
Work for me.
from iohook.
A note to anyone installing with Yarn: be sure to remove iohook from your global cache before reinstalling or you won't end up with the builds for the environments that you've added.
yarn cache clean iohook
from iohook.
Hi there,
Did you add the 'iohook' config in your package.json ? According to your env, i'll say :
"iohook": {
"targets": [
"node-59",
"electron-54"
],
"platforms": [
"win32",
"darwin"
],
"arches": [
"x64",
"ia32"
]
}
And then re-download your dependencies; this way it will fetch prebuild versions of iohook for node (the one you use in development and when using electron .
AND for electron (the one you are supposed to use in production.
from iohook.
Hi Djiit! Thanks so much for the quick reply. yeah I def did it and actually added all the electron versions available since I get an error when I don't do it. my ioHook config in my package.json looks like this:
"iohook": {
"targets": [
"node-59",
"electron-47",
"electron-54",
"electron-57"
],
"platforms": [
"win32",
"darwin"
],
"arches": [
"x64",
"ia32"
]
}
Then, I am running yarn add ioHook
to re-fetch the binaries.
But, still as soon as I try to compile the app and run the result - I get the same error that the ioHook library is missing.
from iohook.
Hi @Djiit ,
I actually referred to the yarn run build
command which packs the app. I tried now to get rid of the --asar
flag from the electron-packager
command so the library won't make an archive file from the source code. that actually solved the problem! and my app works just fine. BUT! I do want to "hide" my code inside an archive file. so I assume once the app is in an archive, it can't find the ioHook
library.
Any ideas? I am digging into it now and will come back with updates.
from iohook.
@zxc23 thank you for your reply, I was able to find the solution, I was using the latest electron version, but it seems, for now, it is only supported on 8.x.x, this comment here explains basically everything you need to do:
from iohook.
That is weird. What is the error you get when you don't add "all the electron versions" ?
from iohook.
that the electron version is missing and I need to install it, every time it shows about a different version
from iohook.
You should only have one electron target, the one corresponding to your current electron version. Can you copy/paste your results here ?
from iohook.
Hi @Djiit thanks for the quick reply and sorry for my late response - I was busy with holiday times :)
So I did what you just told me to do (I am running NodeJS 9.2.0 so I am using build 59 and Electron 1.7.0 so I'm using build 57) I left only these two in the package.json
file as you said.
I have packed the app using electron-packager
, it packed the app successfully and as soon as I try to run the packed app I get this window:
Both in Windows and Mac.
Any ideas why does it happen?
from iohook.
@Djiit help? ππ»
from iohook.
Are you sure the prebuild version are presents in node_module/iohook ?
Also can you try to make a minimal app to reproduce the problem ? (i.e. electron and iohook only)
from iohook.
Hi, @Djiit sorry for the late response.
and then each build has folders: builds/Release/iohook.node
- Yeah, I just created a minimal side-project to see if it happens there and it doesn't! So I went back to my app, updated the library from 1.3 to 1.5, updated electron to 1.8.4 and nodeJS to 9.2.0, went to the package.json file and set the
electronVersion
to 1.8.4, the targets areelectron-57
andnode-59
, tried to runyarn run build --overwrite
, then run the result on my mac and the same thing, tried with windows - same thing:
I have a single file that requires electron and iohook, watching the mouseclick
event to do a simple thing. can't see anything that could cause the problem.
any ideas?
from iohook.
Well, that's weird.
Would you mind granting me a read-only access to your repository ? I think I'll have a couple hours free this weekend to check it out.
You shouldn't have to build anything as you are on macOS and we provide prebuilt binaries...
from iohook.
electron-rebuild
sometimes fixes these issues. https://github.com/electron/electron-rebuild
from iohook.
@Djiit : I will push this project to a private repo and will invite you to it. many thanks, man! I am not building anything that is related to iohook, when I said "build" I referred to package the electron app with electron-packager
@matthewshirley Ok, tried to use this library - I added it to my project, then from the terminal I exected ./node_modules/.bin/electron-rebuild
successfully, then tried to use electron-packager
again and the result still the same. I am just using the electron-packager
directly from the CLI, under the scripts
property in my package.json
file I have:
"build": "electron-packager . $npm_package_productName --out=dist --ignore='^/dist$' --prune --asar --all --version=$npm_package_electronVersion"
what do I do wrong here?
from iohook.
Is electron included as a dependency in your package.json?
from iohook.
@matthewshirley only in devDependencies
: "electron": "^1.8.4",
from iohook.
Do you have electron-rebuild installed globally or locally? If locally, run the command:
./node_modules/.bin/electron-rebuild -f iohook
from iohook.
@matthewshirley doesn't help :(
from iohook.
@Djiit Hi! sorry for the delay - added you yesterday as a contributor to the repo
from iohook.
Hey @egantz !
So I cloned our repository, I ran yarn
and then yarn start
: your app was working like a charm, printing the pressed mouse button in the terminal.
Note that I had to remove some lines (condition regarding the log level of the app) to make it work; but this is in no way related to ioHook.
I'm on a up-to-date 2013 MacBook Pro.
from iohook.
I tried to drop the --asar flag but it still doesn't work here. So strange :(
from iohook.
really? ok so it works but I really want to use the asar in order to get to an archive file instead of the source files to be exposed. I will try to dig more into their documentation and will send some updates here
from iohook.
Hi, now Windows' giving me hard times - Error: %1 is not a valid Win32 application. \\?\C:\Windows\Help\log-analysis-win32-ia32\resources\app\node_modules\iohook\builds\electron-v57-win32-ia32\build\Release\iohook.node
Any ideas? I see the file but it says it's invalid for some reason.
from iohook.
What did you change in your code or configuration ?
from iohook.
nothing that was really related to the library itself. but I finally managed to pack the app, and tried to run it on windows x64 for the first time - and bumped into this error.
from iohook.
Hi there, any news on this ?
from iohook.
Hi @Djiit, thanks for the follow up. We ditched this project for now, so I never got any updates about that. If we'll get back to it. I will drop here any updates we'll have. Thanks again!
from iohook.
Thanks for the feedback, I'm closing this now, feel free to comment here in the future and we'll reopen it.
from iohook.
Facing this
Screen grab is from dev tools of electron app
Here is my package.json
Package.json
{
"name": "<Project name :P>",
"version": "1.19.0",
"description": "A simple electron app for <project name :P>",
"main": "main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "electron main.js",
"setup": "node build.js",
"icon": "node icon.js"
},
"repository": {
"type": "git",
"url": "<Project URL>"
},
"iohook": {
"targets": [
"node-59",
"electron-54"
],
"platforms": [
"win32",
"darwin"
],
"arches": [
"x64",
"ia32"
]
},
"cmake-js": {
"runtime": "electron",
"runtimeVersion": "1.4.13"
},
"keywords": [
"electron",
"windows",
"mac"
],
"author": "Arpit Vasani",
"license": "ISC",
"devDependencies": {
"asar": "^0.14.0",
"electron": "^1.7.10",
"electron-installer-dmg": "^0.2.1",
"electron-installer-windows": "*",
"electron-packager": "^10.1.1",
"electron-winstaller": "^2.6.3"
},
"dependencies": {
"aws-sdk": "^2.340.0",
"electron-rebuild": "^1.8.2",
"electron-squirrel-startup": "^1.0.0",
"iohook": "^0.3.1",
"network": "^0.4.0",
"util": "^0.11.1"
}
}
from iohook.
Nice video. Thanks for taking efforts for it.
from iohook.
Nice video. Thanks for taking efforts for it.
Welcome!
Lots of Thanks to iohook team for making such an awesome module.
from iohook.
Thanks for the feedback, I'm closing this now, feel free to comment here in the future and we'll reopen it.
@Djiit I didn't see any resolution
from iohook.
Hi @Djiit ,
I actually referred to the
yarn run build
command which packs the app. I tried now to get rid of the--asar
flag from theelectron-packager
command so the library won't make an archive file from the source code. that actually solved the problem! and my app works just fine. BUT! I do want to "hide" my code inside an archive file. so I assume once the app is in an archive, it can't find theioHook
library.Any ideas? I am digging into it now and will come back with updates.
@egantz this is exactly the problem I am still stuck on. Please reopen the issue.
from iohook.
Hi @Djiit ,
I actually referred to the
yarn run build
command which packs the app. I tried now to get rid of the--asar
flag from theelectron-packager
command so the library won't make an archive file from the source code. that actually solved the problem! and my app works just fine. BUT! I do want to "hide" my code inside an archive file. so I assume once the app is in an archive, it can't find theioHook
library.Any ideas? I am digging into it now and will come back with updates.
I also found it to work without asar and fail with asar. So I ran asar with iohook unpackaged and I got this error
those files are included in the unpackaged folder
!!update it is working on a different computer and a build from Travis CI. I believe the issue lies with visual c++ build tools
from iohook.
Experiencing the above on some PCs and not others. Quite weird. They are all Win32 x64 PCs.
from iohook.
Same issue here, works well with folder. BUT, when I pack folder to asar, and run from asar, it gives me message: xxx.tmp.node could not be found. when I extract the same app.asar to app folder, it works.
from iohook.
I think the issues is caused by dependency of uiohook.dll, electron could recognize .node file, and extract it to temp folder, then change require path to temp .node path internally, but It can't extract dll files.
I suggest compile uiohook to iohook.node with static link, not dynamic link.
Or do not pack it to asar, just folder.
from iohook.
After installing my application, I've noticed that resources/
has app.asar.unpacked
which contains node_modules/iohook/
. It looks like on installation, iohook is unpacked from the asar (I guess it needs to be in order to be used properly?). But on some computers, the electron application can't locate the unpacked iohook.node file, which in my case would be located in resources\app.asar.unpacked\node_modules\iohook\builds\electron-v70-win32-x64\build\Release
from iohook.
I face the same issue on a fresh electron quickstart app.
Reproduction steps:
$ git clone https://github.com/electron/electron-quick-start
# Go into the repository
$ cd electron-quick-start
# Install dependencies
$ yarn
# Run the app
$ yarn start
# Add iohook
$ yarn add iohook
# Require it in main.js
main.js
const ioHook = require("iohook");
ioHook.on("keyup", event => {
console.log(event); // {keychar: 'f', keycode: 19, rawcode: 15, type: 'keup'}
});
ioHook.start();
error
App threw an error during load
Error: Cannot find module '/Users/d/tmp/electron-quick-start/node_modules/iohook/builds/electron-v75-darwin-x64/build/Release/iohook.node'
Require stack:
- /Users/d/tmp/electron-quick-start/node_modules/iohook/index.js
- /Users/d/tmp/electron-quick-start/main.js
- /Users/d/tmp/electron-quick-start/node_modules/electron/dist/Electron.app/Contents/Resources/default_app.asar/main.js
-
at Module._resolveFilename (internal/modules/cjs/loader.js:717:15)
at Function../lib/common/reset-search-paths.ts.Module._resolveFilename (electron/js2c/browser_init.js:7613:16)
at Module._load (internal/modules/cjs/loader.js:622:27)
at Module._load (electron/js2c/asar.js:717:26)
at Function.Module._load (electron/js2c/asar.js:717:26)
at Module.require (internal/modules/cjs/loader.js:775:19)
at require (internal/modules/cjs/helpers.js:68:18)
at Object.<anonymous> (/Users/d/tmp/electron-quick-start/node_modules/iohook/index.js:10:21)
at Module._compile (internal/modules/cjs/loader.js:880:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:892:10)
from iohook.
I'm running into the same issue ^
from iohook.
I've faced this issue as well on my end and no matter what I'm trying from the advices from this issue - neither yarn
nor npm
can download proper node binding.
package.json
"iohook": {
"targets": [
"electron-76"
],
"platforms": [
"win32",
"darwin",
"linux"
],
"arches": [
"x64",
"ia32"
]
},
But inside node_modules I can see only 1 binding probably based on my mac host env.
I've tried to clean caches, reinstall all modules with both yarn
and npm
and nothing helped and I still have Error: Cannot find module '/Users/leontii.hrabovetskyi/Projects/desktop-communicator/node_modules/iohook/builds/electron-v76-darwin-x64/build/Release/iohook.node'
Any further advices please? I can download electron-v76-darwin-x64
manually and place it inside a folder from screenshot above but this doesn't work for CI obviously.
EDIT: Not sure how this helped but I succeeded to get all needed files after added asarUnpack
value under build
in package.json
.
"build": {
"asarUnpack": "**/*.node"
}
from iohook.
I'm having the same problem:
Cannot find module '/Users/myuser/apps/myproject/node_modules/electron/dist/
Electron.app/Contents/Resources/electron.asar/renderer/
builds/electron-v80-darwin-x64/build/Release/iohook.node'
And the file exists inside the node_modules/iohook
folder:
Any ideas?
from iohook.
Looks like I forgot to reference and post in this issue.
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:
from iohook.
@zxc23 actually I'm not on windows, I don't think that solves my problem :(
from iohook.
@felipe-augusto Oh, that's too bad, I have no ideas. I had the problem on Windows 10 machines and this was the only solution which worked for them.
from iohook.
Can we have a solution for Electron 9.x.x??
from iohook.
If you are using two package.json structure with electron-builder, just add iohook
in your app/package.json
.
works on:
Electron React Boilerplate v1.3.0
Node v12.13.0 (abi: 72)
Electron v8.4.3 (abi: 76)
from iohook.
Same behaviour in Electron 11
from iohook.
@zxc23 thank you for your reply, I was able to find the solution, I was using the latest electron version, but it seems, for now, it is only supported on 8.x.x, this comment here explains basically everything you need to do:
I change to 8.5.5 ,I added files to builds like ,what do more for it with you ? @felipe-augusto
from iohook.
Closing as irrelevant. This doesn't seem to be an issue anymore. Feel free to reopen with some more up-to-date info.
from iohook.
same error I'm getting in linux
please give me some solution
from iohook.
Related Issues (20)
- Update Electron Support HOT 2
- Cannot find module iohook.node HOT 2
- (node:72347) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 keydown listeners added to [IOHook]. Use emitter.setMaxListeners() to increase limit
- Unable to install iohook because of npm errors HOT 4
- How can check iohook is started or stopped
- iohook build different node js version HOT 15
- Update dist-url for build.js script
- Building for node v18.13.0 and Electron 22.0.0 HOT 3
- Release to github fails when manual build.
- Version 0.9.0 is not build for Windows 11 HOT 1
- Uncaught Exception: Error: Cannot find module '/home/logicrays/Documents/practice project/Learn electronjs/web-tracker-electron-app/node_modules/iohook/builds/electron-v113-linux-x64/build/Release/iohook.node' HOT 3
- Non-existing version of iohook, v0.9.3-node-v111-win32-x64 HOT 3
- Build a version for Electron v24.4.0 HOT 5
- Error to install over mac and nodejs v14 & v15 HOT 3
- iohook.node is not a valid Win32 application HOT 3
- Couldn't install iohook in my electron app HOT 3
- when manually building on windows, node-gyp generated .dll, but not .node HOT 19
- Error while installing HOT 2
- 404 NPM Install HOT 4
- Attempting to iinstall on Macbook Pro on latest version of MacOS
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iohook.