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

v17 node support. #1912

Closed
ThunderDoesDev opened this issue Oct 25, 2021 · 5 comments
Closed

v17 node support. #1912

ThunderDoesDev opened this issue Oct 25, 2021 · 5 comments

Comments

@ThunderDoesDev
Copy link

Please add support for node version 17+.

@liukaigsx
Copy link

compiling from source code can make it

@Dosojin1
Copy link

Check my issue.
You can download the node_module at last command
Link to my fixed issue

@embeddedt
Copy link

embeddedt commented Nov 11, 2021

I was getting the following error when using node-canvas as a dependency with Node v17:

npm ERR! gyp info using node-gyp@8.3.0
npm ERR! gyp info using node@17.1.0 | linux | x64
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! In file included from ../../nan/nan.h:2884,
npm ERR!                  from ../src/backend/Backend.h:6,
npm ERR!                  from ../src/backend/Backend.cc:1:
npm ERR! ../../nan/nan_typedarray_contents.h: In constructor 'Nan::TypedArrayContents<T>::TypedArrayContents(v8::Local<v8::Value>)':
npm ERR! ../../nan/nan_typedarray_contents.h:34:43: error: 'class v8::ArrayBuffer' has no member named 'GetContents'
npm ERR!    34 |       data   = static_cast<char*>(buffer->GetContents().Data()) + byte_offset;
npm ERR!       |                                           ^~~~~~~~~~~
npm ERR! make: *** [canvas.target.mk:162: Release/obj.target/canvas/src/backend/Backend.o] Error 1

Making the following changes to my package.json (in particular, pinning nan to 2.15+ to include nodejs/nan#888) solved the issue.

diff --git a/package.json b/package.json
index cb1e7a7..467d91c 100644
--- a/package.json
+++ b/package.json
@@ -37,11 +37,12 @@
     "core-js": "^3.8.1",
     "parcel-bundler": "^1.12.5",
     "posthtml-include": "^1.4.3",
-    "typescript": "^3.9.5"
+    "typescript": "^3.9.5",
+    "nan": "^2.15.0"
   },
   "dependencies": {
     "bs-custom-file-input": "^1.3.4",
-    "canvas": "^2.7.0",
+    "canvas": "^2.8.0",
     "file-saver": "^2.0.5",
     "locutus": "^2.0.11",
     "rgbquant": "^1.1.2",

I think this can be solved upstream by bumping the nan dependency here:

"nan": "^2.14.0",

@zbjornson
Copy link
Collaborator

Prebuilds for Node.js v17, canvas 2.8.0 are now available for Linux glibc x64 and macOS x64.

Windows failed to build, still looking into that.

@zbjornson
Copy link
Collaborator

Prebuilds for Windows x64, node-canvas v2.8.0, Node.js v17 are now available as well.

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

No branches or pull requests

5 participants