question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Loading iohook doesn't work

See original GitHub issue

Describe the bug Using vue-cli + vue-cli-electron-installer Added the iohook settings according to my setup Edited package.json

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

npm i

I can see the correct build .node file in my node_modules, but npm run electron:serve throws an error :

Error: Cannot find module '/Users/useruser/Projects/project/dist_electron/builds/electron-v85-darwin-x64/build/Release/iohook.node'
    at webpackEmptyContext (webpack:///./node_modules/iohook_sync?:2:10)
    at eval (webpack:///./node_modules/iohook/index.js?:10:80)
    at Object../node_modules/iohook/index.js (/Users/useruser/Projects/project/dist_electron/index.js:1163:1)
    at __webpack_require__ (/Users/useruser/Projects/project/dist_electron/index.js:20:30)
    at eval (webpack:///./src/background.js?:16:16)
    at Module../src/background.js (/Users/useruser/Projects/project/dist_electron/index.js:2451:1)
    at __webpack_require__ (/Users/useruser/Projects/project/dist_electron/index.js:20:30)
    at eval (webpack:///multi_./src/background.js?:1:18)
    at Object.0 (/Users/useruser/Projects/project/dist_electron/index.js:2522:1)
    at __webpack_require__ (/Users/useruser/Projects/project/dist_electron/index.js:20:30)

I tried to manually copy the iohook.node file in the expected folder structure (under dist_electron/builds/electron-v85-darwin-x64/build/Release/) but it also does not work (although the file exists).

To Reproduce Steps to reproduce the behavior:

Create a vue-cli project, add vue-cli-plugin-electron-installer, and add iohook as a dependency.

Environment (please complete the following information):

System:
    OS: macOS 11.1
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
  Binaries:
    Node: 14.15.3 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.9 - /usr/local/bin/npm
  Browsers:
    Chrome: Not Found
    Edge: Not Found
    Firefox: 84.0.2
    Safari: Not Found
  npmPackages:
    @vue/babel-helper-vue-jsx-merge-props:  1.2.1
    @vue/babel-helper-vue-transform-on:  1.0.2
    @vue/babel-plugin-jsx:  1.0.3
    @vue/babel-plugin-transform-vue-jsx:  1.2.1
    @vue/babel-preset-app:  4.5.11
    @vue/babel-preset-jsx:  1.2.4
    @vue/babel-sugar-composition-api-inject-h:  1.2.1
    @vue/babel-sugar-composition-api-render-instance:  1.2.4
    @vue/babel-sugar-functional-vue:  1.2.2
    @vue/babel-sugar-inject-h:  1.2.2
    @vue/babel-sugar-v-model:  1.2.3
    @vue/babel-sugar-v-on:  1.2.3
    @vue/cli-overlay:  4.5.11
    @vue/cli-plugin-babel: ~4.5.0 => 4.5.11
    @vue/cli-plugin-eslint: ~4.5.0 => 4.5.11
    @vue/cli-plugin-router: ~4.5.0 => 4.5.11
    @vue/cli-plugin-vuex: ~4.5.0 => 4.5.11
    @vue/cli-service: ~4.5.0 => 4.5.11
    @vue/cli-shared-utils:  4.5.11
    @vue/component-compiler-utils:  3.2.0
    @vue/eslint-config-prettier: ^6.0.0 => 6.0.0
    @vue/preload-webpack-plugin:  1.1.2
    @vue/web-component-wrapper:  1.2.0
    eslint-plugin-vue: ^6.2.2 => 6.2.2
    vue: ^2.6.11 => 2.6.12
    vue-cli-plugin-electron-builder: ~2.0.0-rc.6 => 2.0.0-rc.6
    vue-eslint-parser:  7.4.1
    vue-hot-reload-api:  2.3.4
    vue-loader:  15.9.6 (16.1.2)
    vue-router: ^3.2.0 => 3.5.1
    vue-style-loader:  4.1.2
    vue-template-compiler: ^2.6.11 => 2.6.12
    vue-template-es2015-compiler:  1.9.1
    vuex: ^3.4.0 => 3.6.2
    vuex-electron: ^1.0.3 => 1.0.3
  npmGlobalPackages:
    @vue/cli: 4.5.11

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

7reactions
michelvermeulencommented, Mar 5, 2021

SUCCESS!

So thanks to both your comments, I think I figured it out. iohook was in my devDependencies, and moving it to dependencies + adding to the externals did the trick!

Guys, I can’t stress enough how this was a pin in my *** so massive thanks! 💙

0reactions
nklaymancommented, Mar 4, 2021

@michelvermeulen I don’t see anything that looks like it would cause an issue. Adding it as an external worked for me (and for @Wurielle), so I don’t think it is an issue with this plugin, so I’ll close this. If you can create a demo repo that shows the error and post it here, I’ll look into it. Otherwise, I can’t really help you as I can’t trigger the error myself.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't use iohook on a simple node app · Issue #275 - GitHub
Found that the error occurs on require("iohook") (initial load). The crash appears to occur within the constructor of IOHook class, ...
Read more >
How to use iohook with electron js and node js - Stack Overflow
I am using electron js(version 13.1.9) and node js (version 14.12.0). Used this code but still not working.
Read more >
What's the loading strategy that events and banks use in EBP?
When an event or bank asset is loaded, the media assets it references are also be loaded into memory (or an IO hook...
Read more >
A build of my app does not work with iohook on windows. Can ...
I am very new to electron, but I think this error is not on me. I have an electron app that works well...
Read more >
Usage | iohook
Before installing this module, you will need to set a runtime version in your package.json . When developing with webpack, you will need...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found