octalmage / robotjs

Node.js Desktop Automation.
http://robotjs.io
MIT License
12.37k stars 961 forks source link

Node - was compiled against a different Node.js version using NODE_MODULE_VERSION 72 #602

Closed nayan2 closed 4 years ago

nayan2 commented 4 years ago

I am working on a node application. Basically its a VS Code extension. Where I am planning to use the package. But 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, usingnpm rebuildornpm install)

The package should work smoothly.

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, usingnpm rebuildornpm install)

I tried to rebuild the package using both node-gyp and npm rebuild. Still the same error.

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?

My Environment

s1hofmann commented 4 years ago

The problem you're facing is the fact that your VS Code extension will be using Electron instead of node.

ABI version 75 corresponds to Electron 7.x.x, so you either have to pre-build and release your own Electron version of robotjs or give nut.js a try which already provides pre-builds.

nayan2 commented 4 years ago

@s1hofmann Thanks, I have rebuilt the package successfully. Although initially, I did several things wrong. Like my extension electron package and vs code electron version was different.

Anyone who will face the same problem, my suggestion will be to check the VS code electron and node version first. Then rebuild the electron package.

buuug7 commented 3 years ago

@nayan2 where is VS code electron, where can i find the VS code electron, i use webstorm ?