2

I am working on a node application. Where I have to work with robotjs. When I tried to install the package to my node app, I am getting some error.

Activating extension 'x' failed: The module '\\? 
\d:\x\app\node_modules\robotjs\build\Release\robotjs.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 72. This version of Node.js requires
NODE_MODULE_VERSION 75. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`)

I thought It might be because of my Node version. S0 I change my node version from v12.18.3 to v14.9.0.

But after changing that, I am getting.

Activating extension 'x' failed: The module 
'\\?\d:\x\app\node_modules\robotjs\build\Release\robotjs.node' 
was compiled against a different Node.js version using NODE_MODULE_VERSION 83. 
This version of Node.js requires NODE_MODULE_VERSION 75. 
Please try re-compiling or re-installing the module (for instance, using `npm rebuild` or `npm 
install`)

After searching about my problem and robotjs I have found out this robotjs-stackoverflow.

But that is also not working for me. I tried to rebuild the robotjs package targeting NODE_MODULE_VERSION 75. Still the same issue.

After a little bit of digging, I found out that there is no node version that contained NODE_MODULE_VERSION 75. Check the NODE_MODULE_VERSION column. Then why I am getting the error. Any help?

2 Answers 2

4

Try these approaches

1)You have to rebuild the package and tell npm to update it's binary too. Try:

npm rebuild robotjs --update-binary
  1. if it doesn't work, You need to remove the module folder (robotjs) from the node_modules folder and reinstall it, use the following commands:

      rm -rf node_modules/robotjs
    
      npm install
    

Refer this for more Node - was compiled against a different Node.js version using NODE_MODULE_VERSION 51

Here is the list node_module version https://nodejs.org/en/download/releases/

3 npm cache clean --force Try following these steps if you are on windows

Sign up to request clarification or add additional context in comments.

2 Comments

No result, Still same error. tried both npm rebuild robotjs --update-binary and .\node_modules\.bin\electron-rebuild.cmd. After applying npm rebuild robotjs --update-binary error is same but after applying .\node_modules\.bin\electron-rebuild.cmd error change from NODE_MODULE_VERSION 72 to 83. Can you tell me what the error trying to mean This version of Node.js requires NODE_MODULE_VERSION 75 ??
npm rebuild using your local node , which isn't what robotjs has.This is what error means.
1

this actually solve my problem

npm i robotjs
npm i -D electron-rebuild
npm install -g node-gyp
npx electron-rebuild -f -t prod,optional,dev -w robotjs

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.