GitMurf / help

Building a repo to provide to others for help and troubleshooting
1 stars 0 forks source link

Electron + pdfjs/node-canvas - Compiled against a different Node.js version - NODE_MODULE_VERSION 108 vs NODE_MODULE_VERSION 109 #1

Open GitMurf opened 1 year ago

GitMurf commented 1 year ago

First thing we need to solve is how to get pdfjs https://github.com/mozilla/pdf.js (with its node-canvas dependency as the issue) to be properly compiled against the correct version of Node that Electron is using since node-canvas is a native node module.

node-canvas (https://github.com/Automattic/node-canvas) does have pre-builds to use but there is not a version that matches to the Electron node version it seems.

image

GitMurf commented 1 year ago

I am testing on a Windows 11 machine right now.

GitMurf commented 1 year ago

Here is the project I am testing with right now: https://github.com/GitMurf/help/tree/main/electron-pdf-node-canvas-help

GitMurf commented 1 year ago

I have tried using electron-rebuild (https://github.com/electron/rebuild) https://github.com/GitMurf/help/commit/48050d560c5f21fcb5251c4eed9df0ac76a6262f but I get the following error.

image

GitMurf commented 1 year ago

Here is info about using native node modules with Electron: https://www.electronjs.org/docs/latest/tutorial/using-native-node-modules