node native_error ai_generated true

Error: dlopen failed: cannot load native module

ID: node/err-dlopen-failed

Also available as: JSON · Markdown
88%Fix Rate
90%Confidence
50Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
20 active

Root Cause

Native addon compiled for different Node/architecture. Need to rebuild.

generic

Workarounds

  1. 95% success Rebuild native modules: npm rebuild or rm -rf node_modules && npm install
    npm rebuild
    # or: npx node-gyp rebuild

    Sources: https://nodejs.org/api/addons.html

  2. 88% success For Electron apps, use electron-rebuild: npx electron-rebuild
    npx electron-rebuild

    Sources: https://www.electronjs.org/docs/latest/tutorial/using-native-node-modules

Dead Ends

Common approaches that don't work:

  1. Copy node_modules from another machine 85% fail

    Native addons are platform-specific — compiled binaries aren't portable

  2. Downgrade Node to match the addon 60% fail

    Better to rebuild the addon for your current Node version

Error Chain

Frequently confused with: