mscdex/mmmagic

Error: The module 'magic.node' was compiled against a different Node.js version

ianchanning opened this issue · 1 comments

I get the following error when using esbuild to compile a node project:

Error: The module '/home/ian/my-electron-app/node_modules/mmmagic/build/Release/magic.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 93. This version of Node.js requires
NODE_MODULE_VERSION 114. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at process.func [as dlopen] (node:electron/js2c/asar_bundle:2:1822)
    at Module._extensions..node (node:internal/modules/cjs/loader:1326:18)
    at Object.func [as .node] (node:electron/js2c/asar_bundle:2:1822)
    at Module.load (node:internal/modules/cjs/loader:1096:32)
    at Module._load (node:internal/modules/cjs/loader:937:12)
    at f._load (node:electron/js2c/asar_bundle:2:13330)
    at Module.require (node:internal/modules/cjs/loader:1120:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (/home/ian/mona/health-app-develop/node_modules/mmmagic/lib/index.js:1:13)
    at Module._compile (node:internal/modules/cjs/loader:1241:14)
mscdex commented

You need to rebuild node addons when you switch to a new major version of node. In the case of Electron, you need to rebuild addons using whatever tool they have for doing so.