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.12.1 #2374

Closed
1 task done
Vishwas2707 opened this issue Apr 11, 2024 · 3 comments
Closed
1 task done

Canvas installation failure with Node v20.12.1 #2374

Vishwas2707 opened this issue Apr 11, 2024 · 3 comments

Comments

@Vishwas2707
Copy link

Issue or Feature

Getting this error only in node version of 20 above works fine with LTS version 18.20.1

Steps to Reproduce

> canvas@2.9.0 install
> node-pre-gyp install --fallback-to-build

node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@1.0.11
node-pre-gyp info using node@20.12.1 | darwin | arm64
node-pre-gyp info build requesting source compile
gyp info it worked if it ends with ok
gyp info using node-gyp@10.0.1
gyp info using node@20.12.1 | darwin | arm64
gyp info ok 
gyp info it worked if it ends with ok
gyp info using node-gyp@10.0.1
gyp info using node@20.12.1 | darwin | arm64
gyp info find Python using Python version 3.11.4 found at "/Library/Frameworks/Python.framework/Versions/3.11/bin/python3"

gyp info spawn /Library/Frameworks/Python.framework/Versions/3.11/bin/python3
gyp info spawn args [
gyp info spawn args '/Users/vishwas/.nvm/versions/node/v20.12.1/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/vishwas/CitizenEngagement/SPM-WebApps/node_modules/canvas/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/vishwas/.nvm/versions/node/v20.12.1/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/vishwas/Library/Caches/node-gyp/20.12.1/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/vishwas/Library/Caches/node-gyp/20.12.1',
gyp info spawn args '-Dnode_gyp_dir=/Users/vishwas/.nvm/versions/node/v20.12.1/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/Users/vishwas/Library/Caches/node-gyp/20.12.1/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/Users/vishwas/CitizenEngagement/SPM-WebApps/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 node-gyp@10.0.1
gyp info using node@20.12.1 | 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:
../src/backend/Backend.h:60:14: warning: private field 'backend' is not used [-Wunused-private-field]
    Backend* backend;
             ^
1 warning generated.
  CXX(target) Release/obj.target/canvas/src/backend/ImageBackend.o
  CXX(target) Release/obj.target/canvas/src/backend/PdfBackend.o
  CXX(target) Release/obj.target/canvas/src/backend/SvgBackend.o
  CXX(target) Release/obj.target/canvas/src/bmp/BMPParser.o
  CXX(target) Release/obj.target/canvas/src/Backends.o
  CXX(target) Release/obj.target/canvas/src/Canvas.o
In file included from ../src/Canvas.cc:21:
../src/Util.h:25:7: error: no member named 'AccessorSignature' in namespace 'v8'
                v8::AccessorSignature::New(v8::Isolate::GetCurrent(), ctor)
                ~~~~^
1 error generated.
make: *** [Release/obj.target/canvas/src/Canvas.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.<anonymous> (/Users/vishwas/.nvm/versions/node/v20.12.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
gyp ERR! System Darwin 23.4.0
gyp ERR! command "/Users/vishwas/.nvm/versions/node/v20.12.1/bin/node" "/Users/vishwas/.nvm/versions/node/v20.12.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/vishwas/CitizenEngagement/SPM-WebApps/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/Users/vishwas/CitizenEngagement/SPM-WebApps/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/vishwas/CitizenEngagement/SPM-WebApps/node_modules/canvas
gyp ERR! node -v v20.12.1
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/vishwas/.nvm/versions/node/v20.12.1/bin/node /Users/vishwas/.nvm/versions/node/v20.12.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/vishwas/CitizenEngagement/SPM-WebApps/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/Users/vishwas/CitizenEngagement/SPM-WebApps/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/vishwas/CitizenEngagement/SPM-WebApps/node_modules/canvas/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:518: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.4.0
node-pre-gyp ERR! command "/Users/vishwas/.nvm/versions/node/v20.12.1/bin/node" "/Users/vishwas/CitizenEngagement/SPM-WebApps/node_modules/canvas/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/vishwas/CitizenEngagement/SPM-WebApps/node_modules/canvas
node-pre-gyp ERR! node -v v20.12.1
node-pre-gyp ERR! node-pre-gyp -v v1.0.11
node-pre-gyp ERR! not ok 
Failed to execute '/Users/vishwas/.nvm/versions/node/v20.12.1/bin/node /Users/vishwas/.nvm/versions/node/v20.12.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/vishwas/CitizenEngagement/SPM-WebApps/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/Users/vishwas/CitizenEngagement/SPM-WebApps/node_modules/canvas/build/Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v115' (1)
npm ERR! code 1
npm ERR! path /Users/vishwas/CitizenEngagement/SPM-WebApps/node_modules/canvas
npm ERR! command failed
npm ERR! command sh -c node-pre-gyp install --fallback-to-build

Your Environment

  • Version of node-canvas (output of npm list canvas or yarn list canvas): installing latest 2.11.2
  • Environment (e.g. node 20.9.0 on macOS 14.1.1): node LTS v20.12.1
@Vishwas2707 Vishwas2707 changed the title Canvas installation failure Canvas installation failure with Node v20.12.1 Apr 11, 2024
@TrevorSayre
Copy link

TrevorSayre commented Apr 11, 2024

I'm able to install on Node 20.12.2 on macOS 14.4.1 with an Apple Silicon chipset:

brew install pkg-config cairo pango libpng jpeg giflib librsvg pixman python@3.12
rm -rf node_modules
npm install

If you don't have the brew command from homebrew: https://brew.sh

@Vishwas2707
Copy link
Author

Vishwas2707 commented Apr 12, 2024

Thanks Trevor for replying, I did brew install pkg-config cairo pango libpng jpeg giflib librsvg pixman python@3.12
with Node 20.12.2 on macOS 14.4.1 and
Its working fine after i updated latest versions of canvas and resemblejs.

@berekmerilorand
Copy link

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 tried with:
brew install pkg-config cairo pango libpng jpeg giflib librsvg pixman python@3.12
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 node-pre-gyp@1.0.10
node-pre-gyp info using node@20.10.0 | 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 canvas@2.10.1 and node@20.10.0 (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 node-gyp@10.0.1
gyp info using node@20.10.0 | darwin | arm64
gyp info ok 
gyp info it worked if it ends with ok
gyp info using node-gyp@10.0.1
gyp info using node@20.10.0 | darwin | arm64
gyp info find Python using Python version 3.12.5 found at "/opt/homebrew/opt/python@3.12/bin/python3.12"

gyp info spawn /opt/homebrew/opt/python@3.12/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 node-gyp@10.0.1
gyp info using node@20.10.0 | 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

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