Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

canvas.node file not working with require method #1668

Closed
gislayer opened this issue Sep 20, 2020 · 3 comments
Closed

canvas.node file not working with require method #1668

gislayer opened this issue Sep 20, 2020 · 3 comments

Comments

@gislayer
Copy link

gislayer commented Sep 20, 2020

Hi, everyone!
I am using electron.js for my project. I need to use canvas for publishing map tiles. When I use with another empty expressjs project it is working perfect but when I use it in electron js it never worked. it's thrown me this error.

You can try in electron-quick-start repo.
As i said, even i have pulled electron-quick-start repo and added node-canvas but again i have get same issue.

App threw an error during load
Error: The module '\?....\node_modules\canvas\build\Release\canvas.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 72. This version of Node.js requires
NODE_MODULE_VERSION 82. 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.js:140:31)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1196:18)
at Object.func [as .node] (electron/js2c/asar.js:140:31)
at Module.load (internal/modules/cjs/loader.js:981:32)
at Module._load (internal/modules/cjs/loader.js:881:14)
at Function.Module._load (electron/js2c/asar.js:769:28)
at Module.require (internal/modules/cjs/loader.js:1023:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object. (E:....\node_modules\canvas\lib\bindings.js:3:18)
at Module._compile (internal/modules/cjs/loader.js:1145:30)

is there any solution for that. I didn't fix it

By the way i have read your other same issues and tried but nothing changed.

@gislayer
Copy link
Author

@zbjornson can you help me ?

@ischyrus
Copy link

ischyrus commented Oct 9, 2020

I had this same issue. Try switching to the LTS release of node (12.19.0) rather than using the current (14.13.1). That fixed it for me.

@zbjornson
Copy link
Collaborator

See #1511:

I get a NODE_MODULE_VERSION error

The log may look like

...was compiled against a different Node.js version using NODE_MODULE_VERSION 72.
This version of Node.js requires NODE_MODULE_VERSION 64. Please try re-compiling or
re-installing the module

This could mean you upgraded Node.js without re-installing canvas. Try running yarn or npm install again.


#1511 has additional info on use with Electron, however.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants