Skip to main content

Posts

Showing posts with the label Node-gyp

Resolving 'Module was compiled against a different Node.js version' in Electron

  If you are developing an Electron application involving native C++ modules—such as   better-sqlite3 ,   serialport , or your own custom Node addons—you have almost certainly encountered this compile-time ABI mismatch: Error: The module '/path/to/project/node_modules/better-sqlite3/build/Release/better_sqlite3.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`). The generic advice to "delete  node_modules  and run  npm install " rarely works here. This error persists because of a fundamental architectural divergence between your system's Node.js runtime and Electron's bundled runtime. Root Cause Analysis: The ABI Divergence Node.js and Electron both rely on the V8 JavaScript engine. However, they rarely share the exact same version of V8 at any given release poin...