-
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 |
Canvas failed to install with Yarn on macOS and NodeJS 22.7.0 because it couldn't find online binaries. I had installed all dependencies, but it still failed to build due to a missing environment. You need to configure the find /usr/local/Cellar -name 'pkgconfig' -type d | tr '\n' ':' | sed s/.$// In your export PKG_CONFIG_PATH="...output from previous command..." Just a heads-up, this output is versioned, so you might need to maintain it after Homebrew updates, but don't do it manually. It could be hundreds of dependencies, instead use this script to update it (it assumes zsh is the default shell and bash 3): #!/bin/bash
# Get the new value from the command. This is the versioned command mentioned before.
NEW_VALUE="$(find /usr/local/Cellar -name 'pkgconfig' -type d | tr '\n' ':' | sed s/.$//)"
# Check if the variable is already set.
if grep -q "export PKG_CONFIG_PATH" ~/.zshrc; then
# Replace the old value with the new value. Use a sed delimiter that's unlikely to appear in a file path.
# It will also back up the previous configuration.
sed -i.bak "s#export PKG_CONFIG_PATH=.*#export PKG_CONFIG_PATH=\"$NEW_VALUE\"#g" ~/.zshrc
else
# Add the variable if it's not already set.
echo "export PKG_CONFIG_PATH=\"$NEW_VALUE\"" >> ~/.zshrc
fi After setting this variable Canvas builds successfully. |
Hi @chearon would it be possible to get prebuilt binaries released for Node 22.11.0, given node-canvas 3.0 is still an rc? I'm still not sure from the above discussion if there is an incompatibility blocking this or if we just need binaries to be released. Thanks in advance. |
I think it's just prebuilds: canvas 2.11.2 doesn't have binaries for Node 22. It would be difficult to update the binaries for 2.11.2 since the prebuild scripts have to change so much in order to build 3.0, but I could make an attempt at running the old script. The prebuilds are a massive pain and what's holding everything back. I've got some time carved out this weekend to try to get 3.0 released, though. |
Hi @chearon just following up to see if running the old script was successful or if the only path forward is to set up build tooling to build this yourself. And in the latter case, in an enterprise environment, would it be possible for us to build our own prebuilt and host it on a custom mirror? Thanks again for having a look here. |
Yes, this is not building on 22 version |
Canvas doesn't build on v22 or v20 for me. 👌 I think it's been 5 years of consistent issues just getting this package to install at all. Even within a docker container is risky, it's easier to build a container that has this working once then use that as the base image for everything else. It sucks if you need to update anything like security packages, but hey, that's the "Wordpress-Company" way.
I've downgraded all the way down to node 16. I've gone from 2.11.2 down a few versions and it still didn't work. wasm-sjlj also is imported dynamically during the canvas build and that was also causing gyp issues (now fixed). I think Automattic really needs to consider if they should be investing in consistent compilation/builds instead of lawsuits.
Ok.
I must have already done that at some point.
Ok. Tried it on Sonoma 14 and 15, both fail. Windows 10, & Ubuntu 22.04.
I've already decided to drop this package entirely because after 5 years this still doesn't have a reliable build toolchain. The devs can decide to fix the actual problem or suggest broken solutions which last a few months before the same root issue causes another build problem. I've wasted days trying to resolve what exactly is missing, y'all can spend some time just making this usable. 👋
Yeah. If I remove "canvas" all of my install problems go away. |
@Sieabah: Please read the above carefully. Instead of complaining, get rid of this package and encourage others to do so as well... |
@cmahnke I already swapped to @napi-rs/canvas, but it is absolutely not 1:1 compatible. Anything dealing with clipping masks just doesn't work, or doesn't work identically. So I have to have alternative code on the backend node renderer vs the frontend browser renderer. I'm moving to just rewrite what I do with canvas into something else entirely (both frontend & backend). I guess you found the edge case that I didn't mock in my complaint. This isn't a solution or "answer" that actually solves the problem... I'm not going to go back through the comments and install random shit or create work for me to maintain this setup across OS's and dev laptops. I identified that this package is pulling unpinned deps and expecting it to "just work". No, I'm not making a PR to fix them because I'm not signing myself up to maintain that, nor do I want to have to negotiate that through a merge process. I'm aware of what people have tried here because I've been dealing with this package having install issues for years. It'll eventually work then break, then work, then break. All the while the version has been pinned the whole time. What good does using a separate package do to fixing this one? It would be nice if this package just worked instead of it being so problematic. I wanted to express that more than temporary solutions that someone will be trying a year from now when it's broken again, begging for it to work. |
@Sieabah I hope, you're not getting me wrong, but my point of view on this issue is: This module had it's problems for years, you also mentioned them. They are scattered across this issue tracker. In the end those (and a few more) are a clear indication that the development model / priorities for this project are a bit of. That being said, I don't see any reasons why this should be fixed at all and instead try to find a good replacement... Or you just try another package like Canvaskit-WASM |
The following helped me on Debian Bookworm. Probably does not resolve the original issue here but I'm still posting it hoping to help someone out there.
|
I've released 3.0.0 which removes NAN, so this should be fixed. The only breaking change for 3.0.0 was dropping support for old Node versions, so users of Node 22 should be able to safely upgrade. |
@chearon do i understand good that we dont need any
|
@dgtllion correct, I can confirm that with I removed the GitHub Actions step in this PR: |
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: