Within an Electron project I just tried requiring RobotJS and got the error:
Uncaught Error: The module
'\\?\C:\Users\\... snip ...\app\bot\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 89. Please try re-compiling or re-installing the
module (for instance, using `npm rebuild` or `npm install`).
And I tried the suggested npm install
and npm rebuild
within the node_modules/robotjs
directory, but the error wasn't fixed.
I tried a few different versions. I'm currently on the latest RobotJS branch, so I tried going to past Electron versions.
Electron 11.0.0 (obviously earliest 11.x version): Node.js version using NODE_MODULE_VERSION 83. This version of Node.js requires NODE_MODULE_VERSION 85.
Electron 10.4.7 (latest 10.x version): Node.js version using NODE_MODULE_VERSION 83. This version of Node.js requires NODE_MODULE_VERSION 82.
There doesn't seem to be any Electron version between 10.4.7 and 11.0.0, so next I tried going down a RobotJS version, but that's not compatible with my Node.js version:
error C2660: 'v8::Value::Int32Value': function does not take 0 arguments
And I'd rather not go down various Node.js versions and electron versions on the off chance there's one that matches perfectly.
Is there an easier way to find out if any versions are compatible than trial / error? Or better yet, would fixing the compatibility be possible without extensive modification of one of the libs?