0

am trying to use robotjs in an electron(v5.0.5) application when i run the application , i get the error below , i used electron-rebuild command :

./node_modules/.bin/electron-rebuild 

and used npm rebuild as well and i still getting the same issue.

i also installed nvm and tried node version 12.0.0,12.0.4,8.16.

how can i fix this issue ?

 App threw an error during load
    Error: The module '/app/node_modules/robotjs/build/Release/robotjs.node'
    was compiled against a different Node.js version using
    NODE_MODULE_VERSION 57. This version of Node.js requires
    NODE_MODULE_VERSION 70. Please try re-compiling or re-installing
    the module (for instance, using `npm rebuild` or `npm install`).
        at process.func [as dlopen] (electron/js2c/asar.js:155:31)
        at Object.Module._extensions..node (internal/modules/cjs/loader.js:850:18)
        at Object.func [as .node] (electron/js2c/asar.js:155:31)
        at Module.load (internal/modules/cjs/loader.js:677:32)
        at tryModuleLoad (internal/modules/cjs/loader.js:609:12)
        at Function.Module._load (internal/modules/cjs/loader.js:601:3)
        at Module.require (internal/modules/cjs/loader.js:715:19)
        at require (internal/modules/cjs/helpers.js:14:16)
        at Object.<anonymous> (/app/node_modules/robotjs/index.js:1:15)
        at Module._compile (internal/modules/cjs/loader.js:808:30)
Hasan Al-Natour
  • 1,936
  • 2
  • 14
  • 22
  • Looks like you have the same issue as [this](https://stackoverflow.com/questions/56643383/how-do-i-implement-a-nfc-reader-acr122-to-an-electron-project/56647424#56647424). – aabuhijleh Jun 25 '19 at 07:47
  • I followed it and didn't work as well – Hasan Al-Natour Jun 25 '19 at 08:31
  • What happens when you run `electron-rebuild`? This command must finish successfully. – aabuhijleh Jun 25 '19 at 08:34
  • i get "✔ Rebuild Complete" but when i run the app again it gives me the same error – Hasan Al-Natour Jun 25 '19 at 08:37
  • use Node v10.x, use Electron v4.x, delete your `node_modules` folder, run `npm i`, run `electron-rebuild` then run the app. Don't use `npm rebuild` at all. – aabuhijleh Jun 25 '19 at 08:46
  • i used node v10 and electron v4 and deleted node-modules , npm i then i used './node_modules/.bin/electron-rebuild' i got this error (robotjs.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 57. This version of Node.js requires NODE_MODULE_VERSION 69. Please try re-compiling or re-installing) – Hasan Al-Natour Jun 25 '19 at 08:55

0 Answers0