-2

I am making a desktop application using electron which requires canvas as a plugin (for a feature of the app). It runs perfectly fine when only one of the plugins are installed, but for whatever reason, when both are installed, it throws this error. I've tried reinstalling all of the plugins but it didn't help. Does anyone know the cause?

Error: The module 'Desktop\code\Applications\NFT-Generator\node_modules\canvas\build\Release\canvas.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 102. This version of Node.js requires
NODE_MODULE_VERSION 89. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at process.func [as dlopen] (electron/js2c/asar_bundle.js:5:1846)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1138:18)
    at Object.func [as .node] (electron/js2c/asar_bundle.js:5:1846)
    at Module.load (internal/modules/cjs/loader.js:935:32)
    at Module._load (internal/modules/cjs/loader.js:776:14)
    at Function.f._load (electron/js2c/asar_bundle.js:5:12913)
    at Module.require (internal/modules/cjs/loader.js:959:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (Desktop\code\Applications\NFT-Generator\node_modules\canvas\lib\bindings.js:3:18)
    at Module._compile (internal/modules/cjs/loader.js:1078:30)
NMRice
  • 7
  • 2
  • https://stackoverflow.com/questions/46384591/node-was-compiled-against-a-different-node-js-version-using-node-module-versio – vfioox May 31 '22 at 21:04
  • @vfioox I have already previously tried all of these, but none seemed to fix the error. I have already looked pretty far into it but for some reason none of the answers seem to be working. Uninstalling + reinstalling, electron-rebuilding, deleting and readding the node modules. None work – NMRice May 31 '22 at 21:16
  • Read this specifically. https://stackoverflow.com/questions/45761864/nodejs-how-to-fix-different-node-module-version There's a chance you are using linux, and your node binaries are set up wrong on the system. – vfioox May 31 '22 at 21:19
  • @vfioox I am using windows. Sorry for not specifying before – NMRice May 31 '22 at 21:20
  • try to update your nodejs perhaps the package you are trying to compile simply requires new nodejs that you just don't have. – vfioox May 31 '22 at 21:22
  • @vfioox I've tried the latest node version, and a few earlier node versions in case the last version of canvas was compiled in an older one for whatever reason, and done npx use [node version], but none of them fixed the error. It did change the number in front of the first NODE_MODULE_VERSION in the error, and i tried matching it to the second, but that didn't work either – NMRice May 31 '22 at 21:26

0 Answers0