Node native addon dlopen Fails at Runtime in CI - Fix the ABI Mismatch
A native addon is a compiled .node binary tied to a Node ABI and platform. Loading one built for a different version or OS fails when dlopen runs.
What this error means
A node process throws an Error from process.dlopen, often saying the module was compiled against a different Node.js version, when it loads a native addon.
node
Error: The module '/home/runner/work/app/app/node_modules/bcrypt/build/Release/bcrypt_lib.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 108. This version of Node.js requires
NODE_MODULE_VERSION 115.
at process.func [as dlopen] (node:internal/modules/cjs/loader:1340:18)Common causes
A cached addon built for a different Node ABI
node_modules restored from cache contains a .node binary compiled for the Node version that was current when the cache was created.
A platform mismatch between build and run
The addon was built on a different OS or CPU than the runner executes on.
How to fix it
Rebuild the addon on the runner
- Rebuild native dependencies against the current Node version.
- Re-run so dlopen loads a matching binary.
GitHub Actions
- run: npm rebuildKey the dependency cache on the Node version
- Include the Node version in the node_modules cache key.
- Invalidate the cache when Node changes so stale binaries are not reused.
How to prevent it
- Include the Node version and OS in dependency cache keys, rebuild native addons after a Node bump, and avoid sharing a node_modules cache across platforms.
Related guides
Node native addon "node-gyp rebuild" Fails at Runtime in CI - Fix the BuildFix node-gyp rebuild failures triggered at runtime in CI by installing the build toolchain and matching the a…
Node "Segmentation fault" from a Native Addon in CI - Diagnose the CrashFix Node.js segmentation faults from a native addon in CI by rebuilding the addon for the runner, upgrading i…
Node "The engine 'node' is incompatible" at Runtime in CI - Align Node VersionsFix the "engine node is incompatible" error in CI by pinning the CI Node version to satisfy the engines field…