frida / frida-node

Frida Node.js bindings
281 stars 65 forks source link

Can't use frida with electron #55

Closed alexisab closed 4 years ago

alexisab commented 4 years ago

Hi ! I'm trying to use frida in my electron app but I get this error when starting the app :

(node:21768) UnhandledPromiseRejectionWarning: Error: The module '/home/alexis/perso/dofus-kraken/node_modules/frida/build/Release/frida_binding.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 72. This version of Node.js requires
NODE_MODULE_VERSION 80. Please try re-compiling or re-installing

Here are the version of the packages I use :

"electron": "^9.2.0",
"frida": "^12.11.11"

I'm on ubuntu 18.04 if it can help !

Thank you !

FrenchYeti commented 4 years ago

It commonly happens when your local NodeJS version is too high, or if you upgraded nodejs after frida-node install. In most of cases, removing frida-node, clearing npm cache, and reinstalling frida-node solves the issue.

alexisab commented 4 years ago

I've clean my npm cache but it doesn't work better :disappointed: . I use node v12.16.3, it should work with frida because in an other project I also use this node version with frida but without electron and it works perfectly

FrenchYeti commented 4 years ago

Did you try to remove your node_modules folder and your package-lock.json from your project's root folder and to run 'npm install' ?

alexisab commented 4 years ago

Yes I did

oleavr commented 4 years ago

The issue is that you need to set two config options so the prebuild for Electron is fetched instead of the one for Node.js:

export npm_config_runtime=electron npm_config_target=9.0.0

Remember to wipe node_modules and re-run npm install after doing this, and be careful so these environment variables are set whenever you use npm in this context.

oleavr commented 4 years ago

@alexisab Just released Frida 12.11.12, which comes with prebuilds for Electron v10 and v11, in addition to v9. The next release will drop prebuilds for v9, so would recommend upgrading to Electron v10 (or v11) soon.