frida / frida-node

Frida Node.js bindings
282 stars 66 forks source link

frida-v12.5.6-electron-v70 Incorrect NODE_MODULE_VERSION #41

Closed FuzzySecurity closed 5 years ago

FuzzySecurity commented 5 years ago

This issue is related to: https://github.com/frida/frida-node/issues/40

When trying to integrate frida with electron I am getting the following error message:

node_modules\frida\build\Release\frida_binding.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 47. This version of Node.js requires
NODE_MODULE_VERSION 70.

Repro

Install a simple boilerplate like so:

set npm_config_runtime=electron
set npm_config_target=5.0.0
npm init
npm install electron@5.0.0
npm install frida

Fill in some basic elements in the core JS to spawn a Window and then include a JS file that has:

const frida = require('frida');

Notes

I have only tested this on Windows (which is where I am developing), please take this into account. I assume here that there is just a bug where the package is reporting the wrong NODE_MODULE_VERSION number as that package should support "70".

oleavr commented 5 years ago

Thanks for reporting!

Was just about to push a release so I took a quick look at this. It turned out to be caused by a stale ~/.node-gyp directory on the Windows build machine. Back in the day when we released binaries for Node.js 5.x, a 5.0.0 directory was created there with header-files that matched Node.js 5.x. However, node-gyp does not namespace these directories with the runtime's identifier, so now, years later, our Electron Windows prebuilds were suddenly built against Node.js 5.x headers. So yeah, technically a bug in node-gyp that starts biting people after using the same machine for long enough that the Electron major version catches up with an ancient version of Node.js that they used to build for.

Just tagged Frida 12.5.7, which should finally have sane Electron 5.x prebuilds for Windows as well. Cheers!