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

Canvas installation failure with Node v20.10.0 #2424

Closed
1 task done
berekmerilorand opened this issue Aug 26, 2024 · 4 comments
Closed
1 task done

Canvas installation failure with Node v20.10.0 #2424

berekmerilorand opened this issue Aug 26, 2024 · 4 comments

Comments

@berekmerilorand
Copy link

berekmerilorand commented Aug 26, 2024

Issue or Feature

Your Environment

  • Version of node-canvas (output of npm list canvas or yarn list canvas): 2.10.1
  • Node v20.10.0
  • macOS with Sonoma 14.16.

Unfortunately I have the same error while trying to install Node v20.10.0 on macOS with Sonoma 14.16.

I've tried to run the below commands but with no success. After those packages are installed and I remove node_modules, same error is thrown.

I've tried with:
brew install pkg-config cairo pango libpng jpeg giflib librsvg pixman [email protected]
brew install pkg-config cairo pango libpng jpeg giflib librsvg pixman
brew install pkg-config cairo pango libpng jpeg giflib librsvg

Output:

brew install pkg-config cairo pango libpng jpeg giflib librsvg pixman

Warning: pkg-config 0.29.2_3 is already installed and up-to-date.
To reinstall 0.29.2_3, run:
  brew reinstall pkg-config
Warning: cairo 1.18.0 is already installed and up-to-date.
To reinstall 1.18.0, run:
  brew reinstall cairo
Warning: pango 1.54.0 is already installed and up-to-date.
To reinstall 1.54.0, run:
  brew reinstall pango
Warning: libpng 1.6.43 is already installed and up-to-date.
To reinstall 1.6.43, run:
  brew reinstall libpng
Warning: jpeg 9f is already installed and up-to-date.
To reinstall 9f, run:
  brew reinstall jpeg
Warning: giflib 5.2.2 is already installed and up-to-date.
To reinstall 5.2.2, run:
  brew reinstall giflib
Warning: librsvg 2.58.3 is already installed and up-to-date.
To reinstall 2.58.3, run:
  brew reinstall librsvg
Warning: pixman 0.42.2 is already installed and up-to-date.
To reinstall 0.42.2, run:
  brew reinstall pixman

Actual canvas related error:

error /Users/lorandberekmeri/git/node_modules/canvas: Command failed.
Exit code: 1
Command: node-pre-gyp install --fallback-to-build --update-binary
Arguments: 
Directory: /Users/lorandberekmeri/git/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-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.10.1/canvas-v2.10.1-node-v115-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.10.1/canvas-v2.10.1-node-v115-darwin-unknown-arm64.tar.gz 
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) 
node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.10.1/canvas-v2.10.1-node-v115-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
gyp info find Python using Python version 3.12.5 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/lorandberekmeri/.nvm/versions/node/v20.10.0/lib/node_modules/npm/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/lorandberekmeri/git/node_modules/canvas/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/lorandberekmeri/.nvm/versions/node/v20.10.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/lorandberekmeri/Library/Caches/node-gyp/20.10.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/lorandberekmeri/Library/Caches/node-gyp/20.10.0',
gyp info spawn args '-Dnode_gyp_dir=/Users/lorandberekmeri/.nvm/versions/node/v20.10.0/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/Users/lorandberekmeri/Library/Caches/node-gyp/20.10.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/Users/lorandberekmeri/git/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:
In file included from ../../nan/nan.h:180:
../../nan/nan_callbacks.h:55:23: error: no member named 'AccessorSignature' in namespace 'v8'
typedef v8::Local<v8::AccessorSignature> Sig;
                  ~~~~^
In file included from ../src/backend/Backend.cc:1:
In file included from ../src/backend/Backend.h:6:
../../nan/nan.h:686:39: warning: 'IdleNotificationDeadline' is deprecated: Use MemoryPressureNotification() to influence the GC schedule. [-Wdeprecated-declarations]
    return v8::Isolate::GetCurrent()->IdleNotificationDeadline(
                                      ^
/Users/lorandberekmeri/Library/Caches/node-gyp/20.10.0/include/node/v8-isolate.h:1291:3: note: 'IdleNotificationDeadline' has been explicitly marked deprecated here
  V8_DEPRECATE_SOON(
  ^
/Users/lorandberekmeri/Library/Caches/node-gyp/20.10.0/include/node/v8config.h:550:39: note: expanded from macro 'V8_DEPRECATE_SOON'
# define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
                                      ^
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]
    Backend* backend;
             ^
2 warnings and 1 error 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.<anonymous> (/Users/lorandberekmeri/.nvm/versions/node/v20.10.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
gyp ERR! System Darwin 23.6.0
gyp ERR! command "/Users/lorandberekmeri/.nvm/versions/node/v20.10.0/bin/node" "/Users/lorandberekmeri/.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/lorandberekmeri/git/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/Users/lorandberekmeri/git/node_modules/canvas/build/Release" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v115"
gyp ERR! cwd /Users/lorandberekmeri/git/node_modules/canvas
gyp ERR! node -v v20.10.0
gyp ERR! node-gyp -v v10.0.1
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/Users/lorandberekmeri/.nvm/versions/node/v20.10.0/bin/node /Users/lorandberekmeri/.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/lorandberekmeri/git/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/Users/lorandberekmeri/git/node_modules/canvas/build/Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v115' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/lorandberekmeri/git/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:514: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 23.6.0
node-pre-gyp ERR! command "/Users/lorandberekmeri/.nvm/versions/node/v20.10.0/bin/node" "/Users/lorandberekmeri/git/node_modules/canvas/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--update-binary"
node-pre-gyp ERR! cwd /Users/lorandberekmeri/git/node_modules/canvas
node-pre-gyp ERR! node -v v20.10.0
node-pre-gyp ERR! node-pre-gyp -v v1.0.10
@Automattic Automattic deleted a comment Aug 26, 2024
@Automattic Automattic deleted a comment Aug 26, 2024
@BlicBoy
Copy link

BlicBoy commented Aug 26, 2024

@berekmerilorand

You probably had problems installing the brew dependencies... Before installing things with brew, try it:
xcode-select --install
Try brew again:
brew install pkg-config cairo pango libpng jpeg giflib librsvg
And install canvas:
npm install canvas

It worked for me 🙂

@berekmerilorand
Copy link
Author

@BlicBoy unfortunately for me it's not working...I did also a brew upgrade, reinstalled all the dependencies, cleaned the node_modules and package-lock.json, but I'm still facing the same error...

@berekmerilorand
Copy link
Author

berekmerilorand commented Aug 27, 2024

Solution was:

rm -rf node_modules
rm -rf package-lock.json
export SDKROOT=$(xcrun --show-sdk-path)
npm install canvas --force

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

3 participants
@BlicBoy @berekmerilorand and others