Automattic / node-canvas

Node canvas is a Cairo backed Canvas implementation for NodeJS.
10.2k stars 1.17k forks source link

NixOs & Devbox #2441

Open oleg-lukasonok opened 1 month ago

oleg-lukasonok commented 1 month ago

Hello,

I've tried to install canvas@next within npm project using NixOs&Devbox

npm error code 1
npm error path /Users/lego/projects-ibm/cognitive-architect/git/Transformation/node_modules/canvas
npm error command failed
npm error command sh -c prebuild-install -r napi || node-gyp rebuild
npm error prebuild-install warn install No prebuilt binaries found (target=7 runtime=napi arch=arm64 libc= platform=darwin)
npm error gyp info it worked if it ends with ok
npm error gyp info using node-gyp@10.1.0
npm error gyp info using node@18.20.4 | darwin | arm64
npm error gyp info find Python using Python version 3.10.15 found at "/Users/lego/projects-ibm/cognitive-architect/git/Transformation/.devbox/nix/profile/default/bin/python3"
npm error gyp info spawn /Users/lego/projects-ibm/cognitive-architect/git/Transformation/.devbox/nix/profile/default/bin/python3
npm error gyp info spawn args [
npm error gyp info spawn args '/nix/store/mq4a000w2661rsz18bc66kspz46xg36i-nodejs-18.20.4/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm error gyp info spawn args 'binding.gyp',
npm error gyp info spawn args '-f',
npm error gyp info spawn args 'make',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/Users/lego/projects-ibm/cognitive-architect/git/Transformation/node_modules/canvas/build/config.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/nix/store/mq4a000w2661rsz18bc66kspz46xg36i-nodejs-18.20.4/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/Users/lego/Library/Caches/node-gyp/18.20.4/include/node/common.gypi',
npm error gyp info spawn args '-Dlibrary=shared_library',
npm error gyp info spawn args '-Dvisibility=default',
npm error gyp info spawn args '-Dnode_root_dir=/Users/lego/Library/Caches/node-gyp/18.20.4',
npm error gyp info spawn args '-Dnode_gyp_dir=/nix/store/mq4a000w2661rsz18bc66kspz46xg36i-nodejs-18.20.4/lib/node_modules/npm/node_modules/node-gyp',
npm error gyp info spawn args '-Dnode_lib_file=/Users/lego/Library/Caches/node-gyp/18.20.4/<(target_arch)/node.lib',
npm error gyp info spawn args '-Dmodule_root_dir=/Users/lego/projects-ibm/cognitive-architect/git/Transformation/node_modules/canvas',
npm error gyp info spawn args '-Dnode_engine=v8',
npm error gyp info spawn args '--depth=.',
npm error gyp info spawn args '--no-parallel',
npm error gyp info spawn args '--generator-output',
npm error gyp info spawn args 'build',
npm error gyp info spawn args '-Goutput_dir=.'
npm error gyp info spawn args ]
npm error Package cairo was not found in the pkg-config search path.
npm error Perhaps you should add the directory containing `cairo.pc'
npm error to the PKG_CONFIG_PATH environment variable
npm error No package 'cairo' found
npm error gyp: Call to 'pkg-config cairo --libs' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
npm error gyp ERR! configure error 
npm error gyp ERR! stack Error: `gyp` failed with exit code: 1
npm error gyp ERR! stack at ChildProcess.<anonymous> (/nix/store/mq4a000w2661rsz18bc66kspz46xg36i-nodejs-18.20.4/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:297:18)
npm error gyp ERR! stack at ChildProcess.emit (node:events:517:28)
npm error gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:292:12)
npm error gyp ERR! System Darwin 24.0.0
npm error gyp ERR! command "/nix/store/mq4a000w2661rsz18bc66kspz46xg36i-nodejs-18.20.4/bin/node" "/nix/store/mq4a000w2661rsz18bc66kspz46xg36i-nodejs-18.20.4/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm error gyp ERR! cwd /Users/lego/projects-ibm/cognitive-architect/git/Transformation/node_modules/canvas
npm error gyp ERR! node -v v18.20.4
npm error gyp ERR! node-gyp -v v10.1.0
npm error gyp ERR! not ok

npm error A complete log of this run can be found in: /Users/lego/.npm/_logs/2024-10-17T20_50_22_776Z-debug-0.log
WildEgo commented 1 week ago

Having the same issue with