Skip to main content

Posts

Showing posts with the label Native Modules

Solving 'NODE_MODULE_VERSION' Mismatches in Electron Native Addons

  You have just successfully compiled your C++ native module. Your unit tests pass in your local Node.js environment. You fire up your Electron application, and the render process crashes with the following stack trace: Uncaught Error: The module '\\?\C:\path\to\addon.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 115. This version of Node.js requires NODE_MODULE_VERSION 121. Please try re-compiling or re-installing the module (for instance, using `npm rebuild` or `npm install`). Running  npm rebuild  rarely fixes this because it rebuilds against your  system  Node version, not the  Electron  Node version. Here is the architectural root cause and the definitive way to manage native compilation targets. The Root Cause: ABI Divergence Electron is not just a wrapper around your system's Node.js installation. It bundles its own forked version of Node.js and, critically, a specific version of the V8 JavaScript engine. ...