-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Build Error: Incompatibility of [email protected]
with Node.js v22.11.0
#2448
Comments
This is also an issue for us, rolling back to version 20 |
We did not find a better solution either |
same |
Having the same issue. |
Binaries aren't found either:
This happens on GitHub Actions, since I use |
My workaround is to upgrade |
There is some build issue with node-canvas package on node:lts (22). See: Automattic/node-canvas#2448
It often happens that node-gyp fails with errors. It would be great if someone could rewrite it using napi-rs. |
@daimalou Have a look at https://github.com/Brooooooklyn/canvas |
For anyone coming to this in the future, I was able to migrate my canvas application very easily to https://github.com/samizdatco/skia-canvas I also tried the above napi-rs/canvas but the Rust typing wasn't playing nice with my app, so the package I linked worked better for my use. Hope this is fixed soon. |
Since no one mentioned it, but this is actually a problem known for some time: Similar: Let's face it, given there also is #2433 and the lastest release is one and a half years old it's safe to assume, that this package is't supported anymore. There isn't even a janitor for the issue tracker and the branch for the next version isn't active either. See ABI versions for the current LTS release here: |
I encountered error messages about "Package pangocairo was not found in the pkg-config search path" with This is after the first error $ pnpm install
...
.../node_modules/canvas install$ node-pre-gyp install --fallback-to-build --update-binary
.../node_modules/canvas install: node-pre-gyp info it worked if it ends with ok
.../node_modules/canvas install: node-pre-gyp info using [email protected]
.../node_modules/canvas install: node-pre-gyp info using [email protected] | linux | x64
.../node_modules/canvas install: (node:1833) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
.../node_modules/canvas install: (Use `node --trace-deprecation ...` to show where the warning was created)
.../node_modules/canvas install: node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v127-linux-glibc-x64.tar.gz
.../node_modules/canvas install: node-pre-gyp ERR! install response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v127-linux-glibc-x64.tar.gz
.../node_modules/canvas install: node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v127 ABI, glibc) (falling back to source compile with node-gyp)
.../node_modules/canvas install: node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v127-linux-glibc-x64.tar.gz
.../node_modules/canvas install: gyp info it worked if it ends with ok
.../node_modules/canvas install: gyp info using [email protected]
.../node_modules/canvas install: gyp info using [email protected] | linux | x64
.../node_modules/canvas install: gyp info ok
.../node_modules/canvas install: gyp info it worked if it ends with ok
.../node_modules/canvas install: gyp info using [email protected]
.../node_modules/canvas install: gyp info using [email protected] | linux | x64
.../node_modules/canvas install: gyp info find Python using Python version 3.10.12 found at "/usr/bin/python3"
.../node_modules/canvas install: gyp http GET https://nodejs.org/download/release/v22.10.0/node-v22.10.0-headers.tar.gz
.../node_modules/canvas install: gyp http 200 https://nodejs.org/download/release/v22.10.0/node-v22.10.0-headers.tar.gz
.../node_modules/canvas install: gyp http GET https://nodejs.org/download/release/v22.10.0/SHASUMS256.txt
.../node_modules/canvas install: gyp http 200 https://nodejs.org/download/release/v22.10.0/SHASUMS256.txt
.../node_modules/canvas install: gyp info spawn /usr/bin/python3
.../node_modules/canvas install: gyp info spawn args [
.../node_modules/canvas install: gyp info spawn args '/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp/gyp/gyp_main.py',
.../node_modules/canvas install: gyp info spawn args 'binding.gyp',
.../node_modules/canvas install: gyp info spawn args '-f',
.../node_modules/canvas install: gyp info spawn args 'make',
.../node_modules/canvas install: gyp info spawn args '-I',
.../node_modules/canvas install: gyp info spawn args '/home/runner/work/security-vulnerability-examples-next-js-postgres/security-vulnerability-examples-next-js-postgres/node_modules/.pnpm/[email protected][email protected]/node_modules/canvas/build/config.gypi',
.../node_modules/canvas install: gyp info spawn args '-I',
.../node_modules/canvas install: gyp info spawn args '/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp/addon.gypi',
.../node_modules/canvas install: gyp info spawn args '-I',
.../node_modules/canvas install: gyp info spawn args '/home/runner/.cache/node-gyp/22.10.0/include/node/common.gypi',
.../node_modules/canvas install: gyp info spawn args '-Dlibrary=shared_library',
.../node_modules/canvas install: gyp info spawn args '-Dvisibility=default',
.../node_modules/canvas install: gyp info spawn args '-Dnode_root_dir=/home/runner/.cache/node-gyp/22.10.0',
.../node_modules/canvas install: gyp info spawn args '-Dnode_gyp_dir=/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp',
.../node_modules/canvas install: gyp info spawn args '-Dnode_lib_file=/home/runner/.cache/node-gyp/22.10.0/<(target_arch)/node.lib',
.../node_modules/canvas install: gyp info spawn args '-Dmodule_root_dir=/home/runner/work/security-vulnerability-examples-next-js-postgres/security-vulnerability-examples-next-js-postgres/node_modules/.pnpm/[email protected][email protected]/node_modules/canvas',
.../node_modules/canvas install: gyp info spawn args '-Dnode_engine=v8',
.../node_modules/canvas install: gyp info spawn args '--depth=.',
.../node_modules/canvas install: gyp info spawn args '--no-parallel',
.../node_modules/canvas install: gyp info spawn args '--generator-output',
.../node_modules/canvas install: gyp info spawn args 'build',
.../node_modules/canvas install: gyp info spawn args '-Goutput_dir=.'
.../node_modules/canvas install: gyp info spawn args ]
.../node_modules/canvas install: Package pangocairo was not found in the pkg-config search path.
.../node_modules/canvas install: Perhaps you should add the directory containing `pangocairo.pc'
.../node_modules/canvas install: to the PKG_CONFIG_PATH environment variable
.../node_modules/canvas install: Package 'pangocairo', required by 'virtual:world', not found
.../node_modules/canvas install: gyp: Call to 'pkg-config pangocairo --libs' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
.../node_modules/canvas install: gyp ERR! configure error
.../node_modules/canvas install: gyp ERR! stack Error: `gyp` failed with exit code: 1
.../node_modules/canvas install: gyp ERR! stack at ChildProcess.<anonymous> (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp/lib/configure.js:317:18)
.../node_modules/canvas install: gyp ERR! stack at ChildProcess.emit (node:events:518:28)
.../node_modules/canvas install: gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:293:12)
.../node_modules/canvas install: gyp ERR! System Linux 6.5.0-1025-azure
.../node_modules/canvas install: gyp ERR! command "/opt/hostedtoolcache/node/22.10.0/x64/bin/node" "/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--update-binary" "--module=/home/runner/work/security-vulnerability-examples-next-js-postgres/security-vulnerability-examples-next-js-postgres/node_modules/.pnpm/[email protected][email protected]/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/home/runner/work/security-vulnerability-examples-next-js-postgres/security-vulnerability-examples-next-js-postgres/node_modules/.pnpm/[email protected][email protected]/node_modules/canvas/build/Release" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v127"
.../node_modules/canvas install: gyp ERR! cwd /home/runner/work/security-vulnerability-examples-next-js-postgres/security-vulnerability-examples-next-js-postgres/node_modules/.pnpm/[email protected][email protected]/node_modules/canvas
.../node_modules/canvas install: gyp ERR! node -v v22.10.0
.../node_modules/canvas install: gyp ERR! node-gyp -v v10.2.0
.../node_modules/canvas install: gyp ERR! not ok
.../node_modules/canvas install: node-pre-gyp ERR! build error
.../node_modules/canvas install: node-pre-gyp ERR! stack Error: Failed to execute '/opt/hostedtoolcache/node/22.10.0/x64/bin/node /home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --update-binary --module=/home/runner/work/security-vulnerability-examples-next-js-postgres/security-vulnerability-examples-next-js-postgres/node_modules/.pnpm/[email protected][email protected]/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/home/runner/work/security-vulnerability-examples-next-js-postgres/security-vulnerability-examples-next-js-postgres/node_modules/.pnpm/[email protected][email protected]/node_modules/canvas/build/Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v127' (1)
.../node_modules/canvas install: node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/home/runner/work/security-vulnerability-examples-next-js-postgres/security-vulnerability-examples-next-js-postgres/node_modules/.pnpm/@[email protected][email protected]/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
.../node_modules/canvas install: node-pre-gyp ERR! stack at ChildProcess.emit (node:events:518:28)
.../node_modules/canvas install: node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1104:16)
.../node_modules/canvas install: node-pre-gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:304:5)
.../node_modules/canvas install: node-pre-gyp ERR! System Linux 6.5.0-1025-azure
.../node_modules/canvas install: node-pre-gyp ERR! command "/opt/hostedtoolcache/node/22.10.0/x64/bin/node" "/home/runner/work/security-vulnerability-examples-next-js-postgres/security-vulnerability-examples-next-js-postgres/node_modules/.pnpm/@[email protected][email protected]/node_modules/@mapbox/node-pre-gyp/bin/node-pre-gyp" "install" "--fallback-to-build" "--update-binary"
.../node_modules/canvas install: node-pre-gyp ERR! cwd /home/runner/work/security-vulnerability-examples-next-js-postgres/security-vulnerability-examples-next-js-postgres/node_modules/.pnpm/[email protected][email protected]/node_modules/canvas
.../node_modules/canvas install: node-pre-gyp ERR! node -v v22.10.0
.../node_modules/canvas install: node-pre-gyp ERR! node-pre-gyp -v v1.0.11
.../node_modules/canvas install: node-pre-gyp ERR! not ok
.../node_modules/canvas install: Failed to execute '/opt/hostedtoolcache/node/22.10.0/x64/bin/node /home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --update-binary --module=/home/runner/work/security-vulnerability-examples-next-js-postgres/security-vulnerability-examples-next-js-postgres/node_modules/.pnpm/[email protected][email protected]/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/home/runner/work/security-vulnerability-examples-next-js-postgres/security-vulnerability-examples-next-js-postgres/node_modules/.pnpm/[email protected][email protected]/node_modules/canvas/build/Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v127' (1)
.../node_modules/canvas install: Failed Resolution: Upgrade to
|
OS | Command |
---|---|
macOS | Using Homebrew:brew install pkg-config cairo pango libpng jpeg giflib librsvg pixman python-setuptools |
Ubuntu | sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev |
I saw that libcairo2-dev
and libpango1.0-dev
were dependencies and these seemed to match my error message "Package pangocairo was not found in the pkg-config search path".
I decided to try installing these dependencies in the GitHub Actions workflow:
# https://github.com/Automattic/node-canvas/blob/a2e10e61413a0d158174a7a869c16aa13e5d3575/Readme.md?plain=1#L39
- name: Install canvas dependencies
run: sudo apt-get install libcairo2-dev libpango1.0-dev
This resolved the issue, as shown in the PR (unfortunately, also contains irrelevant changes):
What about [email protected]
?
If you're still using the non-RC version, then you may receive an additional error "fatal error: gif_lib.h: No such file or directory":
.../node_modules/canvas install$ node-pre-gyp install --fallback-to-build --update-binary
.../node_modules/canvas install: node-pre-gyp info it worked if it ends with ok
.../node_modules/canvas install: node-pre-gyp info using [email protected]
.../node_modules/canvas install: node-pre-gyp info using [email protected] | linux | x64
.../node_modules/canvas install: (node:2048) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
.../node_modules/canvas install: (Use `node --trace-deprecation ...` to show where the warning was created)
.../node_modules/canvas install: node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v127-linux-glibc-x64.tar.gz
.../node_modules/canvas install: node-pre-gyp ERR! install response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v127-linux-glibc-x64.tar.gz
.../node_modules/canvas install: node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v127 ABI, glibc) (falling back to source compile with node-gyp)
.../node_modules/canvas install: node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v127-linux-glibc-x64.tar.gz
.../node_modules/canvas install: gyp info it worked if it ends with ok
.../node_modules/canvas install: gyp info using [email protected]
.../node_modules/canvas install: gyp info using [email protected] | linux | x64
.../node_modules/canvas install: gyp info ok
.../node_modules/canvas install: gyp info it worked if it ends with ok
.../node_modules/canvas install: gyp info using [email protected]
.../node_modules/canvas install: gyp info using [email protected] | linux | x64
.../node_modules/canvas install: gyp info find Python using Python version 3.10.12 found at "/usr/bin/python3"
.../node_modules/canvas install: gyp http GET https://nodejs.org/download/release/v22.10.0/node-v22.10.0-headers.tar.gz
.../node_modules/canvas install: gyp http 200 https://nodejs.org/download/release/v22.10.0/node-v22.10.0-headers.tar.gz
.../node_modules/canvas install: gyp http GET https://nodejs.org/download/release/v22.10.0/SHASUMS256.txt
.../node_modules/canvas install: gyp http 200 https://nodejs.org/download/release/v22.10.0/SHASUMS256.txt
.../node_modules/canvas install: gyp info spawn /usr/bin/python3
.../node_modules/canvas install: gyp info spawn args [
.../node_modules/canvas install: gyp info spawn args '/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp/gyp/gyp_main.py',
.../node_modules/canvas install: gyp info spawn args 'binding.gyp',
.../node_modules/canvas install: gyp info spawn args '-f',
.../node_modules/canvas install: gyp info spawn args 'make',
.../node_modules/canvas install: gyp info spawn args '-I',
.../node_modules/canvas install: gyp info spawn args '/home/runner/work/security-vulnerability-examples-next-js-postgres/security-vulnerability-examples-next-js-postgres/node_modules/.pnpm/[email protected][email protected]/node_modules/canvas/build/config.gypi',
.../node_modules/canvas install: gyp info spawn args '-I',
.../node_modules/canvas install: gyp info spawn args '/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp/addon.gypi',
.../node_modules/canvas install: gyp info spawn args '-I',
.../node_modules/canvas install: gyp info spawn args '/home/runner/.cache/node-gyp/22.10.0/include/node/common.gypi',
.../node_modules/canvas install: gyp info spawn args '-Dlibrary=shared_library',
.../node_modules/canvas install: gyp info spawn args '-Dvisibility=default',
.../node_modules/canvas install: gyp info spawn args '-Dnode_root_dir=/home/runner/.cache/node-gyp/22.10.0',
.../node_modules/canvas install: gyp info spawn args '-Dnode_gyp_dir=/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp',
.../node_modules/canvas install: gyp info spawn args '-Dnode_lib_file=/home/runner/.cache/node-gyp/22.10.0/<(target_arch)/node.lib',
.../node_modules/canvas install: gyp info spawn args '-Dmodule_root_dir=/home/runner/work/security-vulnerability-examples-next-js-postgres/security-vulnerability-examples-next-js-postgres/node_modules/.pnpm/[email protected][email protected]/node_modules/canvas',
.../node_modules/canvas install: gyp info spawn args '-Dnode_engine=v8',
.../node_modules/canvas install: gyp info spawn args '--depth=.',
.../node_modules/canvas install: gyp info spawn args '--no-parallel',
.../node_modules/canvas install: gyp info spawn args '--generator-output',
.../node_modules/canvas install: gyp info spawn args 'build',
.../node_modules/canvas install: gyp info spawn args '-Goutput_dir=.'
.../node_modules/canvas install: gyp info spawn args ]
.../node_modules/canvas install: gyp info ok
.../node_modules/canvas install: gyp info it worked if it ends with ok
.../node_modules/canvas install: gyp info using [email protected]
.../node_modules/canvas install: gyp info using [email protected] | linux | x64
.../node_modules/canvas install: gyp info spawn make
.../node_modules/canvas install: gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
.../node_modules/canvas install: make: Entering directory '/home/runner/work/security-vulnerability-examples-next-js-postgres/security-vulnerability-examples-next-js-postgres/node_modules/.pnpm/[email protected][email protected]/node_modules/canvas/build'
.../node_modules/canvas install: SOLINK_MODULE(target) Release/obj.target/canvas-postbuild.node
.../node_modules/canvas install: COPY Release/canvas-postbuild.node
.../node_modules/canvas install: CXX(target) Release/obj.target/canvas/src/backend/Backend.o
.../node_modules/canvas install: CXX(target) Release/obj.target/canvas/src/backend/ImageBackend.o
.../node_modules/canvas install: CXX(target) Release/obj.target/canvas/src/backend/PdfBackend.o
.../node_modules/canvas install: CXX(target) Release/obj.target/canvas/src/backend/SvgBackend.o
.../node_modules/canvas install: CXX(target) Release/obj.target/canvas/src/bmp/BMPParser.o
.../node_modules/canvas install: CXX(target) Release/obj.target/canvas/src/Backends.o
.../node_modules/canvas install: CXX(target) Release/obj.target/canvas/src/Canvas.o
.../node_modules/canvas install: CXX(target) Release/obj.target/canvas/src/CanvasGradient.o
.../node_modules/canvas install: CXX(target) Release/obj.target/canvas/src/CanvasPattern.o
.../node_modules/canvas install: In file included from ../src/CanvasPattern.cc:6:
.../node_modules/canvas install: ../src/Image.h:18:10: fatal error: gif_lib.h: No such file or directory
.../node_modules/canvas install: 18 | #include <gif_lib.h>
.../node_modules/canvas install: | ^~~~~~~~~~~
.../node_modules/canvas install: compilation terminated.
.../node_modules/canvas install: make: *** [canvas.target.mk:163: Release/obj.target/canvas/src/CanvasPattern.o] Error 1
.../node_modules/canvas install: make: Leaving directory '/home/runner/work/security-vulnerability-examples-next-js-postgres/security-vulnerability-examples-next-js-postgres/node_modules/.pnpm/[email protected][email protected]/node_modules/canvas/build'
.../node_modules/canvas install: gyp ERR! build error
.../node_modules/canvas install: gyp ERR! stack Error: `make` failed with exit code: 2
.../node_modules/canvas install: gyp ERR! stack at ChildProcess.<anonymous> (/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp/lib/build.js:216:23)
.../node_modules/canvas install: gyp ERR! System Linux 6.5.0-1025-azure
.../node_modules/canvas install: gyp ERR! command "/opt/hostedtoolcache/node/22.10.0/x64/bin/node" "/home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--update-binary" "--module=/home/runner/work/security-vulnerability-examples-next-js-postgres/security-vulnerability-examples-next-js-postgres/node_modules/.pnpm/[email protected][email protected]/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/home/runner/work/security-vulnerability-examples-next-js-postgres/security-vulnerability-examples-next-js-postgres/node_modules/.pnpm/[email protected][email protected]/node_modules/canvas/build/Release" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v127"
.../node_modules/canvas install: gyp ERR! cwd /home/runner/work/security-vulnerability-examples-next-js-postgres/security-vulnerability-examples-next-js-postgres/node_modules/.pnpm/[email protected][email protected]/node_modules/canvas
.../node_modules/canvas install: gyp ERR! node -v v22.10.0
.../node_modules/canvas install: gyp ERR! node-gyp -v v10.2.0
.../node_modules/canvas install: gyp ERR! not ok
.../node_modules/canvas install: node-pre-gyp ERR! build error
.../node_modules/canvas install: node-pre-gyp ERR! stack Error: Failed to execute '/opt/hostedtoolcache/node/22.10.0/x64/bin/node /home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --update-binary --module=/home/runner/work/security-vulnerability-examples-next-js-postgres/security-vulnerability-examples-next-js-postgres/node_modules/.pnpm/[email protected][email protected]/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/home/runner/work/security-vulnerability-examples-next-js-postgres/security-vulnerability-examples-next-js-postgres/node_modules/.pnpm/[email protected][email protected]/node_modules/canvas/build/Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v127' (1)
.../node_modules/canvas install: node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/home/runner/work/security-vulnerability-examples-next-js-postgres/security-vulnerability-examples-next-js-postgres/node_modules/.pnpm/@[email protected][email protected]/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
.../node_modules/canvas install: node-pre-gyp ERR! stack at ChildProcess.emit (node:events:518:28)
.../node_modules/canvas install: node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1104:16)
.../node_modules/canvas install: node-pre-gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:304:5)
.../node_modules/canvas install: node-pre-gyp ERR! System Linux 6.5.0-1025-azure
.../node_modules/canvas install: node-pre-gyp ERR! command "/opt/hostedtoolcache/node/22.10.0/x64/bin/node" "/home/runner/work/security-vulnerability-examples-next-js-postgres/security-vulnerability-examples-next-js-postgres/node_modules/.pnpm/@[email protected][email protected]/node_modules/@mapbox/node-pre-gyp/bin/node-pre-gyp" "install" "--fallback-to-build" "--update-binary"
.../node_modules/canvas install: node-pre-gyp ERR! cwd /home/runner/work/security-vulnerability-examples-next-js-postgres/security-vulnerability-examples-next-js-postgres/node_modules/.pnpm/[email protected][email protected]/node_modules/canvas
.../node_modules/canvas install: node-pre-gyp ERR! node -v v22.10.0
.../node_modules/canvas install: node-pre-gyp ERR! node-pre-gyp -v v1.0.11
.../node_modules/canvas install: node-pre-gyp ERR! not ok
.../node_modules/canvas install: Failed to execute '/opt/hostedtoolcache/node/22.10.0/x64/bin/node /home/runner/setup-pnpm/node_modules/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --update-binary --module=/home/runner/work/security-vulnerability-examples-next-js-postgres/security-vulnerability-examples-next-js-postgres/node_modules/.pnpm/[email protected][email protected]/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/home/runner/work/security-vulnerability-examples-next-js-postgres/security-vulnerability-examples-next-js-postgres/node_modules/.pnpm/[email protected][email protected]/node_modules/canvas/build/Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v127' (1)
.../node_modules/canvas install: Failed
This I tried to resolve in the same way, adding the dependency libgif-dev
from the docs that matched the error message (in addition to the existing libcairo2-dev
and libpango1.0-dev
dependencies):
# https://github.com/Automattic/node-canvas/blob/a2e10e61413a0d158174a7a869c16aa13e5d3575/Readme.md?plain=1#L39
- name: Install canvas dependencies
run: sudo apt-get install libcairo2-dev libpango1.0-dev libgif-dev
This also resolved the build issue, as shown in this PR:
@karlhorky Thanks for your extensive and helpful analysis and hints! Anyways: While it's still possible to build the module fro source not everyone either has the required tool chain (or even required knowledge) at had. And that should considered to be perfectly fine. Given that this module is also a dependency for Same goes for the desire to run a pre release version - there are organisations where it's just imposible by policy / compilance frameworks etc.. And in the end it's just inefficient (also resource-wise as in Green-IT) to require users (of transitive dependency) to change their build infrastructure: Providing modules with C extensions is certainly another degree of responsibility, since those are more prone to break then native JS modules. Have a look at the pull requests, there are some to just automate those chores, but their not merged. These are clear indications to me that this project currently doesn't have the resources to support the code properly. While I value your post, I would propose to other readers to use this to prepare a migration / transition. |
Also, questionable professionalism. (Not to mention ethical and even possible legal problems. I am going to go delete my browser cache now...) |
same issue here. I use node 20.10.0 |
@karlhorky Thank you. I took a hint from your article and solved the problem that was with me. I'm using Fabric.js, so I didn't think I could solve the error in canvas 2.11.0 myself. The error message I had is as follows. However, as written in the document, if you installed the packages to compile and use them on your own, there was no error when you did Since yesterday, I haven't been built, but I've finally solved it. |
Same issue on Windows:
|
I've checked to make sure that this is working on multiple node versions from 18-23. I've installed canvas by adding it to a blank project using yarn. It seems to be working when I just install canvas. Here is my build setup using Docker/Podman: https://gist.github.com/sahal/ec57d2e63764e7b125fca54267977bdc. Logs: build-canvas-yarn-18-23-verbose.txt I am, however, having problems when running my Joplin install when using node 23 (see linked ticket). It seems to fail when building [email protected]. I'm not a js dev, so I'm not sure why that might be though. Will follow up with my build logs for Joplin in the linked issue. |
I am also facing issues with the |
@umeshramya : Consider the priority to be to replace |
I solved this by running |
Description:
Hi there,
I'm experiencing build failures when trying to install
[email protected]
using Node.js v22.11.0. It appears there might be compatibility issues between this version of Node.js and thecanvas
module.Environment:
node:lts-slim
as of October 2024)Steps to Reproduce:
Dockerfile Setup:
Install Dependencies:
npm ci
to install all dependencies, including[email protected]
.Observe the Build Failure:
canvas
.Error Log Highlights:
Additional Information:
canvas
installs without errors.Questions:
Compatibility Confirmation:
[email protected]
compatible with Node.js v22.11?Workarounds:
canvas
work with Node.js v22.x?Dependency Updates:
nan
to address this compatibility issue?Thank You:
Thank you for your time and assistance. Any guidance or updates on this matter would be greatly appreciated.
The text was updated successfully, but these errors were encountered: