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

unable to install node-canvas on mac os 15.0(sequoia) #2433

Open
1 task done
satyajitnayk opened this issue Sep 26, 2024 · 9 comments
Open
1 task done

unable to install node-canvas on mac os 15.0(sequoia) #2433

satyajitnayk opened this issue Sep 26, 2024 · 9 comments

Comments

@satyajitnayk
Copy link

Issue or Feature

Steps to Reproduce

getting node-gyp error when installing canvas on latest mac version. node version v20.10.0

Your Environment

  • Version of node-canvas (output of npm list canvas or yarn list canvas):
npm i
npm ERR! code 1
npm ERR! path /Users/satyajitnayak/Documents/github/XXXXXX/node_modules/canvas
npm ERR! command failed
npm ERR! command sh -c node-pre-gyp install --fallback-to-build --update-binary
npm ERR! SOLINK_MODULE(target) Release/canvas-postbuild.node
npm ERR!   CXX(target) Release/obj.target/canvas/src/backend/Backend.o
npm ERR! Failed to execute '/Users/satyajitnayak/.nvm/versions/node/v20.10.0/bin/node /Users/satyajitnayak/.nvm/versions/node/v20.10.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --update-binary --module=/Users/satyajitnayak/Documents/github/XXXXX/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/Users/satyajitnayak/Documents/github/XXXXX/node_modules/canvas/build/Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v115' (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-v115-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-v115-darwin-unknown-arm64.tar.gz 
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v115 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-v115-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.9.6 found at "/Library/Developer/CommandLineTools/usr/bin/python3"
npm ERR! gyp info spawn /Library/Developer/CommandLineTools/usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/Users/satyajitnayak/.nvm/versions/node/v20.10.0/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/satyajitnayak/Documents/github/XXXXXX/node_modules/canvas/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/satyajitnayak/.nvm/versions/node/v20.10.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/satyajitnayak/Library/Caches/node-gyp/20.10.0/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/satyajitnayak/Library/Caches/node-gyp/20.10.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/Users/satyajitnayak/.nvm/versions/node/v20.10.0/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/satyajitnayak/Library/Caches/node-gyp/20.10.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/satyajitnayak/Documents/github/XXXXXX/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! 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 spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! ld: warning: search path '/opt/homebrew/Cellar/qt@5/5.15.10/lib' not found
npm ERR! In file included from ../src/backend/Backend.cc:1:
npm ERR! ../src/backend/Backend.h:5:10: fatal error: 'exception' file not found
npm ERR!     5 | #include <exception>
npm ERR!       |          ^~~~~~~~~~~
npm ERR! 1 error generated.
npm ERR! make: *** [Release/obj.target/canvas/src/backend/Backend.o] Error 1
npm ERR! gyp ERR! build error 
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack at ChildProcess.<anonymous> (/Users/satyajitnayak/.nvm/versions/node/v20.10.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
npm ERR! gyp ERR! System Darwin 24.0.0
npm ERR! gyp ERR! command "/Users/satyajitnayak/.nvm/versions/node/v20.10.0/bin/node" "/Users/satyajitnayak/.nvm/versions/node/v20.10.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--update-binary" "--module=/Users/satyajitnayak/Documents/github/XXXXX/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/Users/satyajitnayak/Documents/github/XXXXX/node_modules/canvas/build/Release" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v115"
npm ERR! gyp ERR! cwd /Users/satyajitnayak/Documents/github/XXXXX/node_modules/canvas
npm ERR! gyp ERR! node -v v20.10.0
npm ERR! gyp ERR! node-gyp -v v10.0.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/satyajitnayak/.nvm/versions/node/v20.10.0/bin/node /Users/satyajitnayak/.nvm/versions/node/v20.10.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --update-binary --module=/Users/satyajitnayak/Documents/github/XXXXX/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/Users/satyajitnayak/Documents/github/XXXX/node_modules/canvas/build/Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v115' (1)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/satyajitnayak/Documents/github/XXXX/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:514:28)
npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1105:16)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:305:5)
npm ERR! node-pre-gyp ERR! System Darwin 24.0.0
npm ERR! node-pre-gyp ERR! command "/Users/satyajitnayak/.nvm/versions/node/v20.10.0/bin/node" "/Users/satyajitnayak/Documents/github/XXXXX/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--update-binary"
npm ERR! node-pre-gyp ERR! cwd /Users/satyajitnayak/Documents/github/XXXXX/node_modules/canvas
npm ERR! node-pre-gyp ERR! node -v v20.10.0
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.9
npm ERR! node-pre-gyp ERR! not ok

npm ERR! A complete log of this run can be found in: /Users/satyajitnayak/.npm/_logs/2024-09-26T16_11_52_180Z-debug-0.log
  • Environment : node 20.10.0 on macOS 15.0(sequoia)
@cmahnke
Copy link

cmahnke commented Sep 26, 2024

Same problem here, given the last release date and previous issues - maybe it's time to deprecate the module?

@satyajitnayk
Copy link
Author

@cmahnke uninstalling & installing back xcode command line tools worked for me for now.

 sudo rm -rf /Library/Developer/CommandLineTools
 xcode-select --install                         

do not update xcode command line tools further

image

@alvis
Copy link

alvis commented Sep 28, 2024

Thanks @satyajitnayk for the hint. It works for me too

@pedrokohler
Copy link

@cmahnke uninstalling & installing back xcode command line tools worked for me for now.

sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
do not update xcode command line tools further

@satyajitnayk I've tried this with macOS 15.0.1 (sequoia) and nodejs v22.8.0 but no luck. I've still got the same issues.

error /Users/work/projects/cornerstone/node_modules/canvas: Command failed.
Exit code: 1
Command: node-pre-gyp install --fallback-to-build --update-binary
Arguments: 
Directory: /Users/work/projects/cornerstone/node_modules/canvas
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | darwin | arm64
(node:63219) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v127-darwin-unknown-arm64.tar.gz
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-darwin-unknown-arm64.tar.gz 
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v127 ABI, unknown) (falling back to source compile with node-gyp) 
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-darwin-unknown-arm64.tar.gz 
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | arm64
gyp info ok 
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | arm64
(node:63247) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
gyp info find Python using Python version 3.12.6 found at "/opt/homebrew/opt/[email protected]/bin/python3.12"
gyp info spawn /opt/homebrew/opt/[email protected]/bin/python3.12
gyp info spawn args [
gyp info spawn args   '/Users/work/projects/cornerstone/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/work/projects/cornerstone/node_modules/canvas/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/work/projects/cornerstone/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/work/Library/Caches/node-gyp/22.8.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/work/Library/Caches/node-gyp/22.8.0',
gyp info spawn args   '-Dnode_gyp_dir=/Users/work/projects/cornerstone/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/work/Library/Caches/node-gyp/22.8.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/work/projects/cornerstone/node_modules/canvas',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info ok 
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | arm64
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  SOLINK_MODULE(target) Release/canvas-postbuild.node
  CXX(target) Release/obj.target/canvas/src/backend/Backend.o
In file included from ../src/backend/Backend.cc:1:
In file included from ../src/backend/Backend.h:6:
../../nan/nan.h:2548:8: error: no matching member function for call to 'SetAccessor'
 2548 |   tpl->SetAccessor(
      |   ~~~~~^~~~~~~~~~~
/Users/work/Library/Caches/node-gyp/22.8.0/include/node/v8-template.h:1055:8: note: candidate function not viable: no known conversion from 'v8::AccessControl' to 'PropertyAttribute' for 5th argument
 1055 |   void SetAccessor(
      |        ^
 1056 |       Local<Name> name, AccessorNameGetterCallback getter,
 1057 |       AccessorNameSetterCallback setter = nullptr,
 1058 |       Local<Value> data = Local<Value>(), PropertyAttribute attribute = None,
      |                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/work/Library/Caches/node-gyp/22.8.0/include/node/v8-template.h:1049:8: note: candidate function not viable: no known conversion from 'imp::NativeGetter' (aka 'void (*)(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value> &)') to 'AccessorGetterCallback' (aka 'void (*)(Local<String>, const PropertyCallbackInfo<Value> &)') for 2nd argument
 1049 |   void SetAccessor(
      |        ^
 1050 |       Local<String> name, AccessorGetterCallback getter,
      |                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../src/backend/Backend.cc:1:
In file included from ../src/backend/Backend.h:6:
../../nan/nan.h:2594:8: error: no matching member function for call to 'SetAccessor'
 2594 |   tpl->SetAccessor(
      |   ~~~~~^~~~~~~~~~~
/Users/work/Library/Caches/node-gyp/22.8.0/include/node/v8-template.h:1055:8: note: candidate function not viable: no known conversion from 'v8::AccessControl' to 'PropertyAttribute' for 5th argument
 1055 |   void SetAccessor(
      |        ^
 1056 |       Local<Name> name, AccessorNameGetterCallback getter,
 1057 |       AccessorNameSetterCallback setter = nullptr,
 1058 |       Local<Value> data = Local<Value>(), PropertyAttribute attribute = None,
      |                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/work/Library/Caches/node-gyp/22.8.0/include/node/v8-template.h:1049:8: note: candidate function not viable: no known conversion from 'imp::NativeGetter' (aka 'void (*)(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value> &)') to 'AccessorGetterCallback' (aka 'void (*)(Local<String>, const PropertyCallbackInfo<Value> &)') for 2nd argument
 1049 |   void SetAccessor(
      |        ^
 1050 |       Local<String> name, AccessorGetterCallback getter,
      |                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../src/backend/Backend.cc:1:
../src/backend/Backend.h:60:14: warning: private field 'backend' is not used [-Wunused-private-field]
   60 |     Backend* backend;
      |              ^
1 warning and 2 errors generated.
make: *** [Release/obj.target/canvas/src/backend/Backend.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/work/projects/cornerstone/node_modules/node-gyp/lib/build.js:203:23)
gyp ERR! stack     at ChildProcess.emit (node:events:520:28)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:294:12)
gyp ERR! System Darwin 24.0.0
gyp ERR! command "/opt/homebrew/Cellar/node/22.8.0/bin/node" "/Users/work/projects/cornerstone/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--update-binary" "--module=/Users/work/projects/cornerstone/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/Users/work/projects/cornerstone/node_modules/canvas/build/Release" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v127"
gyp ERR! cwd /Users/work/projects/cornerstone/node_modules/canvas
gyp ERR! node -v v22.8.0
gyp ERR! node-gyp -v v9.4.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/opt/homebrew/Cellar/node/22.8.0/bin/node /Users/work/projects/cornerstone/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --update-binary --module=/Users/work/projects/cornerstone/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/Users/work/projects/cornerstone/node_modules/canvas/build/Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v127' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/work/projects/cornerstone/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:520:28)
node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1105:16)
node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:305:5)
node-pre-gyp ERR! System Darwin 24.0.0
node-pre-gyp ERR! command "/opt/homebrew/Cellar/node/22.8.0/bin/node" "/Users/work/projects/cornerstone/node_modules/canvas/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--update-binary"
node-pre-gyp ERR! cwd /Users/work/projects/cornerstone/node_modules/canvas
node-pre-gyp ERR! node -v v22.8.0
node-pre-gyp ERR! node-pre-gyp -v v1.0.11
node-pre-gyp ERR! not ok 

@alvis
Copy link

alvis commented Oct 6, 2024

@pedrokohler Have you tried installing it using node 20 LTS instead of 22?

@pedrokohler
Copy link

@alvis it did not work either. I think I'll have to rollback to macOS version 14

@clhenrick
Copy link

clhenrick commented Oct 10, 2024

I ran into a similar issue and the following fixed this for me on Mac OS 14.7:

  1. Installed the Command Line Tools from the XCode app (well really by downloading them from developer.apple.com and then installing them using the Command_Line_Tools_for_Xcode_16.dmg file)

  2. Updated the path to the Command Line Tools in the terminal by doing:
    sudo xcode-select -s /Applications/Xcode.app/Contents/Developer/

I was then able to successfully install node-canvas on my system.

@SHiftLin
Copy link

brew install pkg-config cairo pango libpng jpeg giflib librsvg pixman
This works for me

@schanzer
Copy link

I'm getting the exact same errors -- I've been running node canvas for years until prior versions of OSX (sometimes with a little fiddling around node versions or brew packages), but this is the first time I've been totally blocked from using it.

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

No branches or pull requests

8 participants
@schanzer @clhenrick @cmahnke @alvis @pedrokohler @SHiftLin @satyajitnayk and others