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

"npm install canvas" failed #2404

Open
1 task
waldolin opened this issue Jul 17, 2024 · 7 comments
Open
1 task

"npm install canvas" failed #2404

waldolin opened this issue Jul 17, 2024 · 7 comments

Comments

@waldolin
Copy link

Issue or Feature

PS C:\Users\lin\.node-red> npm install canvas
npm error code 1
npm error path C:\Users\lin\.node-red\node_modules\canvas
npm error command failed
npm error command C:\Windows\system32\cmd.exe /d /s /c node-pre-gyp install --fallback-to-build --update-binary
npm error node:internal/modules/cjs/loader:1189
npm error   throw err;
npm error   ^
npm error
npm error Error: Cannot find module 'C:\Users\lin\.node-red\node_modules\node-pre-gyp\bin\node-pre-gyp'
npm error     at Module._resolveFilename (node:internal/modules/cjs/loader:1186:15)
npm error     at Module._load (node:internal/modules/cjs/loader:1012:27)
npm error     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:158:12)
npm error     at node:internal/main/run_main_module:30:49 {
npm error   code: 'MODULE_NOT_FOUND',
npm error   requireStack: []
npm error }
npm error
npm error Node.js v22.2.0
npm error A complete log of this run can be found in: C:\Users\lin\AppData\Local\npm-cache\_logs\2024-07-17T08_52_41_561Z-debug-0.log
PS C:\Users\lin\.node-red> npm install canvas@next
npm error code 1
npm error path C:\Users\lin\.node-red\node_modules\canvas
npm error command failed
npm error command C:\Windows\system32\cmd.exe /d /s /c prebuild-install -r napi || node-gyp rebuild
npm error Warning: Missing input files:
npm error C:\GTK\bin\libpangoft2-1.0-0.dll
npm error C:\GTK\bin\libfontconfig-1.dll
npm error C:\GTK\bin\libglib-2.0-0.dll
npm error C:\GTK\bin\libfreetype-6.dll
npm error C:\GTK\bin\libexpat-1.dll
npm error C:\GTK\bin\libpangocairo-1.0-0.dll
npm error C:\GTK\bin\libgobject-2.0-0.dll
npm error C:\GTK\bin\libcairo-2.dll
npm error C:\GTK\bin\libpng14-14.dll
npm error C:\GTK\bin\libintl-8.dll
npm error C:\GTK\bin\libgmodule-2.0-0.dll
npm error C:\GTK\bin\libgthread-2.0-0.dll
npm error C:\GTK\bin\libpango-1.0-0.dll
npm error C:\GTK\bin\libpangowin32-1.0-0.dll
npm error �b���ѨM��פ��@���ظm�@�ӱM�סC�Y�n�ҥΥ���ظm�A�зs�W "-m" �ѼơC
npm error
npm error   Backend.cc
npm error C:\Users\lin\.node-red\node_modules\node-addon-api\napi-inl.h(1042,5): warning C4127: ����B�⦡�O�`�� [C:\Users\lin\.node-red\node_modules\canvas\build\canvas.vcxproj]
npm error C:\Users\lin\.node-red\node_modules\node-addon-api\napi-inl.h(1042,5): message : �ЦҼ{��� 'if constexpr' ���z�� [C:\Users\lin\.node-red\node_modules\canvas\build\canvas.vcxproj]
npm error C:\Users\lin\.node-red\node_modules\node-addon-api\napi-inl.h(1057,5): warning C4127: ����B�⦡�O�`�� [C:\Users\lin\.node-red\node_modules\canvas\build\canvas.vcxproj]
npm error C:\Users\lin\.node-red\node_modules\node-addon-api\napi-inl.h(1057,5): message : �ЦҼ{��� 'if constexpr' ���z�� [C:\Users\lin\.node-red\node_modules\canvas\build\canvas.vcxproj]
npm error C:\Users\lin\.node-red\node_modules\canvas\src\backend\Backend.cc(6,7): warning C4458: 'width' ���ŧi�|�������O���� [C:\Users\lin\.node-red\node_modules\canvas\build\canvas.vcxproj]
npm error C:\Users\lin\.node-red\node_modules\canvas\src\backend\Backend.h(18,9): message : �аѾ\ 'Backend::width' ���ŧi [C:\Users\lin\.node-red\node_modules\canvas\build\canvas.vcxproj]
npm error C:\Users\lin\.node-red\node_modules\canvas\src\backend\Backend.cc(7,7): warning C4458: 'height' ���ŧi�|�������O���� [C:\Users\lin\.node-red\node_modules\canvas\build\canvas.vcxproj]
npm error C:\Users\lin\.node-red\node_modules\canvas\src\backend\Backend.h(19,9): message : �аѾ\ 'Backend::height' ���ŧi [C:\Users\lin\.node-red\node_modules\canvas\build\canvas.vcxproj]
npm error   ImageBackend.cc
npm error C:\Users\lin\.node-red\node_modules\node-addon-api\napi-inl.h(1042,5): warning C4127: ����B�⦡�O�`�� [C:\Users\lin\.node-red\node_modules\canvas\build\canvas.vcxproj]
npm error C:\Users\lin\.node-red\node_modules\node-addon-api\napi-inl.h(1042,5): message : �ЦҼ{��� 'if constexpr' ���z�� [C:\Users\lin\.node-red\node_modules\canvas\build\canvas.vcxproj]
npm error C:\Users\lin\.node-red\node_modules\node-addon-api\napi-inl.h(1057,5): warning C4127: ����B�⦡�O�`�� [C:\Users\lin\.node-red\node_modules\canvas\build\canvas.vcxproj]
npm error C:\Users\lin\.node-red\node_modules\node-addon-api\napi-inl.h(1057,5): message : �ЦҼ{��� 'if constexpr' ���z�� [C:\Users\lin\.node-red\node_modules\canvas\build\canvas.vcxproj]
npm error   PdfBackend.cc
npm error C:\Users\lin\.node-red\node_modules\node-addon-api\napi-inl.h(1042,5): warning C4127: ����B�⦡�O�`�� [C:\Users\lin\.node-red\node_modules\canvas\build\canvas.vcxproj]
npm error C:\Users\lin\.node-red\node_modules\node-addon-api\napi-inl.h(1042,5): message : �ЦҼ{��� 'if constexpr' ���z�� [C:\Users\lin\.node-red\node_modules\canvas\build\canvas.vcxproj]
npm error C:\Users\lin\.node-red\node_modules\node-addon-api\napi-inl.h(1057,5): warning C4127: ����B�⦡�O�`�� [C:\Users\lin\.node-red\node_modules\canvas\build\canvas.vcxproj]
npm error C:\Users\lin\.node-red\node_modules\node-addon-api\napi-inl.h(1057,5): message : �ЦҼ{��� 'if constexpr' ���z�� [C:\Users\lin\.node-red\node_modules\canvas\build\canvas.vcxproj]
npm error C:\GTK\include\glib-2.0\glib\gmacros.h(1,1): warning C4819: �ɮקt���L�k�b�ثe�r�X�� (950) �����ܪ��r���C�ХH Unicode �榡�x�s�ɮץH�����ƿ� [C:\Users\lin\.node-red\node_modules\canvas\build\canvas.vcxproj]
npm error C:\GTK\include\glib-2.0\glib\gmacros.h(839,1): warning C4819: �ɮקt���L�k�b�ثe�r�X�� (950) �����ܪ��r���C�ХH Unicode �榡�x�s�ɮץH�����ƿ� [C:\Users\lin\.node-red\node_modules\canvas\build\canvas.vcxproj]
npm error C:\GTK\include\glib-2.0\glib\gatomic.h(1,1): warning C4819: �ɮקt���L�k�b�ثe�r�X�� (950) �����ܪ��r���C�ХH Unicode �榡�x�s�ɮץH�����ƿ� [C:\Users\lin\.node-red\node_modules\canvas\build\canvas.vcxproj]
npm error C:\GTK\include\glib-2.0\glib\gfileutils.h(1,1): warning C4819: �ɮקt���L�k�b�ثe�r�X�� (950) �����ܪ��r���C�ХH Unicode �榡�x�s�ɮץH�����ƿ� [C:\Users\lin\.node-red\node_modules\canvas\build\canvas.vcxproj]
npm error C:\GTK\include\glib-2.0\glib\gmain.h(1,1): warning C4819: �ɮקt���L�k�b�ثe�r�X�� (950) �����ܪ��r���C�ХH Unicode �榡�x�s�ɮץH�����ƿ� [C:\Users\lin\.node-red\node_modules\canvas\build\canvas.vcxproj]
npm error C:\GTK\include\glib-2.0\glib\gtestutils.h(1,1): warning C4819: �ɮקt���L�k�b�ثe�r�X�� (950) �����ܪ��r���C�ХH Unicode �榡�x�s�ɮץH�����ƿ� [C:\Users\lin\.node-red\node_modules\canvas\build\canvas.vcxproj]
npm error C:\GTK\include\glib-2.0\glib\guri.h(1,1): warning C4819: �ɮקt���L�k�b�ثe�r�X�� (950) �����ܪ��r���C�ХH Unicode �榡�x�s�ɮץH�����ƿ� [C:\Users\lin\.node-red\node_modules\canvas\build\canvas.vcxproj]
npm error C:\GTK\include\glib-2.0\glib\glib-autocleanups.h(1,1): warning C4819: �ɮקt���L�k�b�ثe�r�X�� (950) �����ܪ��r���C�ХH Unicode �榡�x�s�ɮץH�����ƿ� [C:\Users\lin\.node-red\node_modules\canvas\build\canvas.vcxproj]
npm error C:\GTK\include\glib-2.0\gobject\gobject.h(1,1): warning C4819: �ɮקt���L�k�b�ثe�r�X�� (950) �����ܪ��r���C�ХH Unicode �榡�x�s�ɮץH�����ƿ� [C:\Users\lin\.node-red\node_modules\canvas\build\canvas.vcxproj]
npm error C:\GTK\include\glib-2.0\gobject\gtype.h(1,1): warning C4819: �ɮקt���L�k�b�ثe�r�X�� (950) �����ܪ��r���C�ХH Unicode �榡�x�s�ɮץH�����ƿ� [C:\Users\lin\.node-red\node_modules\canvas\build\canvas.vcxproj]
npm error C:\GTK\include\glib-2.0\gobject\gtype.h(877,1): warning C4819: �ɮקt���L�k�b�ثe�r�X�� (950) �����ܪ��r���C�ХH Unicode �榡�x�s�ɮץH�����ƿ� [C:\Users\lin\.node-red\node_modules\canvas\build\canvas.vcxproj]
npm error C:\GTK\include\glib-2.0\gobject\gsignal.h(1,1): warning C4819: �ɮקt���L�k�b�ثe�r�X�� (950) �����ܪ��r���C�ХH Unicode �榡�x�s�ɮץH�����ƿ� [C:\Users\lin\.node-red\node_modules\canvas\build\canvas.vcxproj]
npm error C:\GTK\include\pango-1.0\pango\pango-coverage.h(28,10): fatal  error C1083: �L�k�}�ҥ]�t�ɮ�: 'hb.h': No such file or directory [C:\Users\lin\.node-red\node_modules\canvas\build\canvas.vcxproj]
npm error prebuild-install warn install No prebuilt binaries found (target=7 runtime=napi arch=x64 libc= platform=win32)
npm error gyp info it worked if it ends with ok
npm error gyp info using [email protected]
npm error gyp info using [email protected] | win32 | x64
npm error gyp info find Python using Python version 3.12.0 found at "C:\Python312\python.exe"
npm error gyp info find VS using VS2022 (17.6.33712.159) found at:
npm error gyp info find VS "C:\Program Files\Microsoft Visual Studio\2022\Community"
npm error gyp info find VS run with --verbose for detailed information
npm error gyp info spawn C:\Python312\python.exe
npm error gyp info spawn args [
npm error gyp info spawn args 'C:\\Users\\lin\\AppData\\Roaming\\npm\\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 'msvs',
npm error gyp info spawn args '-I',
npm error gyp info spawn args 'C:\\Users\\lin\\.node-red\\node_modules\\canvas\\build\\config.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args 'C:\\Users\\lin\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args 'C:\\Users\\lin\\AppData\\Local\\node-gyp\\Cache\\22.2.0\\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=C:\\Users\\lin\\AppData\\Local\\node-gyp\\Cache\\22.2.0',
npm error gyp info spawn args '-Dnode_gyp_dir=C:\\Users\\lin\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp',
npm error gyp info spawn args '-Dnode_lib_file=C:\\\\Users\\\\lin\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\22.2.0\\\\<(target_arch)\\\\node.lib',
npm error gyp info spawn args '-Dmodule_root_dir=C:\\Users\\lin\\.node-red\\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 'C:\\Users\\lin\\.node-red\\node_modules\\canvas\\build',
npm error gyp info spawn args '-Goutput_dir=.'
npm error gyp info spawn args ]
npm error gyp info spawn C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe
npm error gyp info spawn args [
npm error gyp info spawn args 'build\\binding.sln',
npm error gyp info spawn args '/clp:Verbosity=minimal',
npm error gyp info spawn args '/nologo',
npm error gyp info spawn args '/p:Configuration=Release;Platform=x64'
npm error gyp info spawn args ]
npm error gyp ERR! build error
npm error gyp ERR! stack Error: `C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1
npm error gyp ERR! stack at ChildProcess.<anonymous> (C:\Users\lin\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:209:23)
npm error gyp ERR! stack at ChildProcess.emit (node:events:520:28)
npm error gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:294:12)
npm error gyp ERR! System Windows_NT 10.0.22631
npm error gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\lin\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm error gyp ERR! cwd C:\Users\lin\.node-red\node_modules\canvas
npm error gyp ERR! node -v v22.2.0
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: C:\Users\lin\AppData\Local\npm-cache\_logs\2024-07-17T08_53_36_724Z-debug-0.log

Steps to Reproduce

var Canvas = require('canvas');
var canvas = Canvas.createCanvas(200, 200);
var ctx = canvas.getContext('2d');
// etc.

Your Environment

  • Version of node-canvas (output of npm list canvas or yarn list canvas):
  • Environment (e.g. node 20.9.0 on macOS 14.1.1):
    windows
    i have installed node-pre-gyp
    set C:\GTK
    and add path of environment
    PS C:\Users\lin.node-red> npm install -g node-pre-gyp
    npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
    npm warn deprecated [email protected]: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
    npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
    npm warn deprecated [email protected]: This package is no longer supported.
    npm warn deprecated [email protected]: This package is no longer supported.
    npm warn deprecated [email protected]: This package is no longer supported.
    npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
    npm warn deprecated [email protected]: This package is no longer supported.

added 67 packages in 4s

3 packages are looking for funding
run npm fund for details
PS C:\Users\lin.node-red> node -v
v22.2.0

@Aarbel

This comment was marked as off-topic.

@ckeshava
Copy link

I faced the same issue on MacOS (v14.5, M1 Pro chip). Environment: Node v18.20, npm v9.9.3

➜  explorer git:(hest-env-upgrade) ✗ npm install canvas
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react
npm WARN   peer react@"^17.0.1" from [email protected]
npm WARN   node_modules/enzyme-adapter-react-17-updated
npm WARN     dev enzyme-adapter-react-17-updated@"^1.0.2" from the root project
npm WARN   18 more (jest-environment-enzyme, react-dom, ...)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer react@"0.13.x || 0.14.x || ^15.0.0-0 || ^16.0.0-0" from [email protected]
npm WARN node_modules/enzyme-adapter-utils
npm WARN   enzyme-adapter-utils@"^1.14.0" from [email protected]
npm WARN   node_modules/enzyme-adapter-react-17-updated
npm WARN 
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react
npm WARN   peer react@"0.13.x || 0.14.x || ^15.0.0-0 || ^16.0.0-0" from [email protected]
npm WARN   node_modules/enzyme-adapter-utils
npm WARN     enzyme-adapter-utils@"^1.14.0" from [email protected]
npm WARN     node_modules/enzyme-adapter-react-17-updated
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: [email protected]
npm WARN node_modules/react
npm WARN   peer react@"^17.0.1" from [email protected]
npm WARN   node_modules/enzyme-adapter-react-17-updated
npm WARN     dev enzyme-adapter-react-17-updated@"^1.0.2" from the root project
npm WARN   18 more (jest-environment-enzyme, react-dom, ...)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer react@"^0.14 || ^15.0.0 || ^16.0.0-alpha" from [email protected]
npm WARN node_modules/enzyme-adapter-utils/node_modules/airbnb-prop-types
npm WARN   airbnb-prop-types@"^2.16.0" from [email protected]
npm WARN   node_modules/enzyme-adapter-utils
npm WARN 
npm WARN Conflicting peer dependency: [email protected]
npm WARN node_modules/react
npm WARN   peer react@"^0.14 || ^15.0.0 || ^16.0.0-alpha" from [email protected]
npm WARN   node_modules/enzyme-adapter-utils/node_modules/airbnb-prop-types
npm WARN     airbnb-prop-types@"^2.16.0" from [email protected]
npm WARN     node_modules/enzyme-adapter-utils
npm ERR! code 1
npm ERR! path /Users/ckeshavabs/explorer/node_modules/canvas
npm ERR! command failed
npm ERR! command sh -c node-pre-gyp install --fallback-to-build --update-binary
npm ERR! Failed to execute '/Users/ckeshavabs/.nvm/versions/node/v18.20.4/bin/node /Users/ckeshavabs/.nvm/versions/node/v18.20.4/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --update-binary --module=/Users/ckeshavabs/explorer/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/Users/ckeshavabs/explorer/node_modules/canvas/build/Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108' (1)
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using [email protected]
npm ERR! node-pre-gyp info using [email protected] | darwin | arm64
npm ERR! node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v108-darwin-unknown-arm64.tar.gz
npm ERR! 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-v108-darwin-unknown-arm64.tar.gz 
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v108 ABI, unknown) (falling back to source compile with node-gyp) 
npm ERR! 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-v108-darwin-unknown-arm64.tar.gz 
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | arm64
npm ERR! gyp info ok 
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | arm64
npm ERR! gyp info find Python using Python version 3.11.6 found at "/Users/ckeshavabs/xrpl-py/.venv/bin/python3"
npm ERR! gyp info spawn /Users/ckeshavabs/xrpl-py/.venv/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/Users/ckeshavabs/.nvm/versions/node/v18.20.4/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/ckeshavabs/explorer/node_modules/canvas/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/ckeshavabs/.nvm/versions/node/v18.20.4/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/Users/ckeshavabs/Library/Caches/node-gyp/18.20.4/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/Users/ckeshavabs/Library/Caches/node-gyp/18.20.4',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/Users/ckeshavabs/.nvm/versions/node/v18.20.4/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/Users/ckeshavabs/Library/Caches/node-gyp/18.20.4/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/Users/ckeshavabs/explorer/node_modules/canvas',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! Package pixman-1 was not found in the pkg-config search path.
npm ERR! Perhaps you should add the directory containing `pixman-1.pc'
npm ERR! to the PKG_CONFIG_PATH environment variable
npm ERR! No package 'pixman-1' found
npm ERR! gyp: Call to 'pkg-config pixman-1 --libs' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (/Users/ckeshavabs/.nvm/versions/node/v18.20.4/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:325:16)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:517:28)
npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:292:12)
npm ERR! gyp ERR! System Darwin 23.5.0
npm ERR! gyp ERR! command "/Users/ckeshavabs/.nvm/versions/node/v18.20.4/bin/node" "/Users/ckeshavabs/.nvm/versions/node/v18.20.4/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--update-binary" "--module=/Users/ckeshavabs/explorer/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/Users/ckeshavabs/explorer/node_modules/canvas/build/Release" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v108"
npm ERR! gyp ERR! cwd /Users/ckeshavabs/explorer/node_modules/canvas
npm ERR! gyp ERR! node -v v18.20.4
npm ERR! gyp ERR! node-gyp -v v9.4.1
npm ERR! gyp ERR! not ok 
npm ERR! node-pre-gyp ERR! build error 
npm ERR! node-pre-gyp ERR! stack Error: Failed to execute '/Users/ckeshavabs/.nvm/versions/node/v18.20.4/bin/node /Users/ckeshavabs/.nvm/versions/node/v18.20.4/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --update-binary --module=/Users/ckeshavabs/explorer/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/Users/ckeshavabs/explorer/node_modules/canvas/build/Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108' (1)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/ckeshavabs/explorer/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:517:28)
npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1098:16)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:303:5)
npm ERR! node-pre-gyp ERR! System Darwin 23.5.0
npm ERR! node-pre-gyp ERR! command "/Users/ckeshavabs/.nvm/versions/node/v18.20.4/bin/node" "/Users/ckeshavabs/explorer/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--update-binary"
npm ERR! node-pre-gyp ERR! cwd /Users/ckeshavabs/explorer/node_modules/canvas
npm ERR! node-pre-gyp ERR! node -v v18.20.4
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.5
npm ERR! node-pre-gyp ERR! not ok

npm ERR! A complete log of this run can be found in: /Users/ckeshavabs/.npm/_logs/2024-07-22T18_23_29_052Z-debug-0.log

How can I fix this issue? canvas is a dev-dependency for the project.

@pdp2121
Copy link

pdp2121 commented Jul 22, 2024

Hi, have you tried this (for MacOS):
https://stackoverflow.com/questions/73297594/cannot-install-canvas-on-npm

@ckeshava
Copy link

Hi, have you tried this (for MacOS): https://stackoverflow.com/questions/73297594/cannot-install-canvas-on-npm

thanks, this helped

@SixBeeps
Copy link

SixBeeps commented Jul 24, 2024

I had the same errors running Windows 10 x64, Node.js 22.4.1, neither stable nor next worked.

Turns out I completely missed the Wiki. Followed its instructions and installed the required dependencies.

@waldolin In your environment description, it looks like you're installing node-pre-gyp, did you mean to install node-gyp instead?

@waldolin
Copy link
Author

waldolin commented Nov 5, 2024

I had the same errors running Windows 10 x64, Node.js 22.4.1, neither stable nor next worked.

Turns out I completely missed the Wiki. Followed its instructions and installed the required dependencies.

@waldolin In your environment description, it looks like you're installing node-pre-gyp, did you mean to install node-gyp instead?
npm install node-pre-gyp" failed

@s-h-a-d-o-w
Copy link

s-h-a-d-o-w commented Nov 7, 2024

I had the same errors running Windows 10 x64, Node.js 22.4.1, neither stable nor next worked.

Turns out I completely missed the Wiki. Followed its instructions and installed the required dependencies.

Then the README should be updated. Because right at the top, it says: "By default, binaries for macOS, Linux and Windows will be downloaded."
Those requirements are said to only be necessary if you choose to compile instead.

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

7 participants