Automattic / node-canvas

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

No prebuilt found for arm64 #1662

Open johnweland opened 4 years ago

johnweland commented 4 years ago

Issue or Feature

There seems to be a missing arm64 build of canvas, build from source fails on arm64 as well.

Steps to Reproduce

npm install 
npm install --build-from-source

Your Environment

Logs

when attempting to build directly on my Pi4

> canvas@2.6.1 install /home/jweland/apps/discordbot/node_modules/canvas
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using needle for node-pre-gyp https download 
node-pre-gyp WARN Tried to download(404): https://github.com/node-gfx/node-canvas-prebuilt/releases/download/v2.6.1/canvas-v2.6.1-node-v83-linux-glibc-arm64.tar.gz 
node-pre-gyp WARN Pre-built binaries not found for canvas@2.6.1 and node@14.9.0 (node-v83 ABI, glibc) (falling back to source compile with node-gyp) 
/bin/sh: 1: pkg-config: not found
gyp: Call to 'pkg-config pixman-1 --libs' returned exit status 127 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Linux 5.4.0-1016-raspi
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/home/jweland/apps/discordbot/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/home/jweland/apps/discordbot/node_modules/canvas/build/Release" "--napi_version=6" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v83"
gyp ERR! cwd /home/jweland/apps/discordbot/node_modules/canvas
gyp ERR! node -v v14.9.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/jweland/apps/discordbot/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/home/jweland/apps/discordbot/node_modules/canvas/build/Release --napi_version=6 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/jweland/apps/discordbot/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1047:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
node-pre-gyp ERR! System Linux 5.4.0-1016-raspi
node-pre-gyp ERR! command "/usr/bin/node" "/home/jweland/apps/discordbot/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/jweland/apps/discordbot/node_modules/canvas
node-pre-gyp ERR! node -v v14.9.0
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok 
Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/jweland/apps/discordbot/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/home/jweland/apps/discordbot/node_modules/canvas/build/Release --napi_version=6 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)
npm WARN discord.js-commando@0.11.0-dev requires a peer of @types/better-sqlite3@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js-commando@0.11.0-dev requires a peer of better-sqlite3@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js-commando@0.11.0-dev requires a peer of sqlite@^3.0.0 but none is installed. You must install peer dependencies yourself.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! canvas@2.6.1 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the canvas@2.6.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/jweland/.npm/_logs/2020-09-04T19_08_35_668Z-debug.log

When attempting --build-from-source

> canvas@2.6.1 install /home/jweland/apps/discordbot/node_modules/canvas
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using needle for node-pre-gyp https download 
/bin/sh: 1: pkg-config: not found
gyp: Call to 'pkg-config pixman-1 --libs' returned exit status 127 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Linux 5.4.0-1016-raspi
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/home/jweland/apps/discordbot/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/home/jweland/apps/discordbot/node_modules/canvas/build/Release" "--napi_version=6" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v83"
gyp ERR! cwd /home/jweland/apps/discordbot/node_modules/canvas
gyp ERR! node -v v14.9.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/jweland/apps/discordbot/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/home/jweland/apps/discordbot/node_modules/canvas/build/Release --napi_version=6 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/jweland/apps/discordbot/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1047:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
node-pre-gyp ERR! System Linux 5.4.0-1016-raspi
node-pre-gyp ERR! command "/usr/bin/node" "/home/jweland/apps/discordbot/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/jweland/apps/discordbot/node_modules/canvas
node-pre-gyp ERR! node -v v14.9.0
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok 
Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/jweland/apps/discordbot/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/home/jweland/apps/discordbot/node_modules/canvas/build/Release --napi_version=6 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)
npm WARN commando-mongodb@1.0.3 requires a peer of discord.js-commando@^0.10.0 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js-commando@0.11.0-dev requires a peer of @types/better-sqlite3@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js-commando@0.11.0-dev requires a peer of better-sqlite3@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js-commando@0.11.0-dev requires a peer of sqlite@^3.0.0 but none is installed. You must install peer dependencies yourself.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! canvas@2.6.1 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the canvas@2.6.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/jweland/.npm/_logs/2020-09-04T19_11_05_625Z-debug.log

Works fine on AMD64 architecture just not ARM64.

StefanoCastro commented 4 years ago

Leaving a dot here as I'm in the same boat currently. Looking forward to an ARM64 build.

PiSaucer commented 4 years ago

I am also missing an ARM build, I don't think it is 64. I have a raspberry pi 3 running Raspberry Pi OS and I am trying to use a discord bot that required canvas.

node-pre-gyp WARN Using needle for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://github.com/node-gfx/node-canvas-prebuilt/releases/download/v2.6.1/canvas-v2.6.1-node-v83-linux-glibc-arm.tar.gz
node-pre-gyp WARN Pre-built binaries not found for canvas@2.6.1 and node@14.8.0 (node-v83 ABI, glibc) (falling back to source compile with node-gyp)
Package pixman-1 was not found in the pkg-config search path.
Perhaps you should add the directory containing pixman-1.pc
to the PKG_CONFIG_PATH environment variable
No package pixman-1 found
gyp: Call to pkg-config pixman-1 --libs returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: gyp failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Linux 4.19.118-v7+
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/home/pi/newcalxp/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/home/pi/newcalxp/node_modules/canvas/build/Release" "--napi_version=6" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v83"
gyp ERR! cwd /home/pi/newcalxp/node_modules/canvas
gyp ERR! node -v v14.8.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/pi/newcalxp/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/home/pi/newcalxp/node_modules/canvas/build/Release --napi_version=6 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/pi/newcalxp/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1051:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
node-pre-gyp ERR! System Linux 4.19.118-v7+
node-pre-gyp ERR! command "/usr/bin/node" "/home/pi/newcalxp/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/pi/newcalxp/node_modules/canvas
node-pre-gyp ERR! node -v v14.8.0
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok
Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/pi/newcalxp/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/home/pi/newcalxp/node_modules/canvas/build/Release --napi_version=6 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)
npm WARN notsup Unsupported engine for openvg@0.4.5: wanted: {"node":">=0.8 <0.11"} (current: {"node":"14.8.0","npm":"6.14.7"})
npm WARN notsup Not compatible with your version of node/npm: openvg@0.4.5
npm WARN discord-tutorial-bot@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! canvas@2.6.1 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the canvas@2.6.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pi/.npm/_logs/2020-11-03T21_19_36_436Z-debug.log
Gustl22 commented 3 years ago

FYI: was able to build the package without error (Raspberry PI 3, Ubuntu 20.04 arm64):

$ sudo apt-get update 
$ sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev
$ yarn add canvas

https://github.com/Automattic/node-canvas/wiki/Installation%3A-Ubuntu-and-other-Debian-based-systems

See also: https://github.com/Automattic/node-canvas/issues/1511

bevand10 commented 3 years ago

Given today's announcement from AWS re ARM based Lambda being generally available, will the std npm deploy ship with an appropriate binary?

https://aws.amazon.com/about-aws/whats-new/2021/09/better-price-performance-aws-lambda-functions-aws-graviton2-processor/

tao1 commented 2 years ago

It is painful to use node-canvas on Apple Silicon. Please provide prebuilt binaries for arm64.

TJTorola commented 2 years ago

Same issues on Arch aarch64, I fixed it by installing pango & cairo, so pacman -S cairo pango

landsman commented 2 years ago

I hit this when I did an upgrade my base image from: node:15.10-stretch to node:16.14-stretch.

In the image is already this:

RUN apt-get install -y build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev

to be able to build it from source...

The build was trying to download this URL: `

15 14.78 npm ERR! node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.9.1/canvas-v2.9.1-node-v93-linux-glibc-arm64.tar.gz

`

ninjahamza commented 2 years ago

latest version of rsvp(https://github.com/tildeio/rsvp.js ) and then a global install of node-pre-gyp is required again followed by installing latest version of canvas. Worked for me. Mac M1, Node 16.14.2

ghost commented 2 years ago

Any updates?

laszlo-horvath commented 1 year ago

Found a proposed solution here for M1 Mac. ✅

TL;DR:

  1. brew install pkg-config cairo pango libpng jpeg giflib librsvg
  2. Purge node_modules
  3. Re-install the package
mgol commented 1 year ago

The issue shouldn't be closed since there are still no ARM64 binaries available. Can one of maintainers reopen?

khalilsarwari commented 9 months ago

Any update on this? Prebuilt arm images would be greatly appreciated :)

indexxing commented 7 months ago

I really hope the latest version will have arm64 pre-builds added eventually as I need to them to contribute to a project

khalilsarwari commented 6 months ago

This seems to be a drop-in replacement (minus some changes to font loading iirc) without the need for build during install for arm: https://github.com/Brooooooklyn/canvas