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 Install Errors on docker #9

Closed
tomtom30 opened this issue Apr 22, 2020 · 10 comments
Closed

Canvas Install Errors on docker #9

tomtom30 opened this issue Apr 22, 2020 · 10 comments
Labels

Comments

@tomtom30
Copy link

I have the same problem as [https://github.com//issues/4](this issue).

I tried the root solution but when I connect inside container with root and install.
I get the same error :

bash-5.0# whoami
root
bash-5.0# cd /data/
bash-5.0# npm install node-red-contrib-face-recognition

> [email protected] install /data/node_modules/canvas
> node-pre-gyp install --fallback-to-build

sh: node-pre-gyp: Permission denied
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the [email protected] 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!     /root/.npm/_logs/2020-04-22T15_37_16_722Z-debug.log

Can you help me with this ?
Thanks

@dborsnich
Copy link

dborsnich commented Apr 22, 2020

Hi, I have the same problem. I am running homeassistant ver 0.108.8 with docker. Node red addon 6.2.0

I tried with sudo and doesn´t work

Regards

2020-04-22T19:12:36.665Z Install : node-red-contrib-face-recognition 1.3.3

2020-04-22T19:12:36.388Z npm install --no-audit --no-update-notifier --save --save-prefix="~" --production [email protected]
2020-04-22T19:12:48.191Z [out] 
2020-04-22T19:12:48.191Z [out] > [email protected] install /config/node-red/node_modules/canvas
2020-04-22T19:12:48.191Z [out] > node-pre-gyp install --fallback-to-build
2020-04-22T19:12:48.191Z [out] 
2020-04-22T19:12:48.459Z [err] node-pre-gyp
2020-04-22T19:12:48.459Z [err]  WARN 
2020-04-22T19:12:48.459Z [err] Using request for node-pre-gyp https download 
2020-04-22T19:12:49.676Z [err] node-pre-gyp
2020-04-22T19:12:49.677Z [err]  WARN Tried to download(404): https://github.com/node-gfx/node-canvas-prebuilt/releases/download/v2.6.1/canvas-v2.6.1-node-v72-linux-musl-x64.tar.gz 
2020-04-22T19:12:49.677Z [err] node-pre-gyp WARN 
2020-04-22T19:12:49.677Z [err] Pre-built binaries not found for [email protected] and [email protected] (node-v72 ABI, musl) (falling back to source compile with node-gyp) 
2020-04-22T19:12:51.835Z [err] /bin/sh: pkg-config: not found
2020-04-22T19:12:51.836Z [err] gyp: Call to 'pkg-config pixman-1 --libs' returned exit status 127 while in binding.gyp. while trying to load binding.gyp
2020-04-22T19:12:51.844Z [err] gyp
2020-04-22T19:12:51.844Z [err]  
2020-04-22T19:12:51.844Z [err] ERR! configure error 
2020-04-22T19:12:51.845Z [err] gyp
2020-04-22T19:12:51.845Z [err]  ERR!
2020-04-22T19:12:51.845Z [err]  
2020-04-22T19:12:51.845Z [err] stack Error: `gyp` failed with exit code: 1
2020-04-22T19:12:51.845Z [err] gyp ERR!
2020-04-22T19:12:51.845Z [err]  stack     at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
2020-04-22T19:12:51.845Z [err] gyp 
2020-04-22T19:12:51.845Z [err] ERR! 
2020-04-22T19:12:51.845Z [err] stack     at ChildProcess.emit (events.js:223:5)
2020-04-22T19:12:51.845Z [err] gyp
2020-04-22T19:12:51.845Z [err]  ERR! 
2020-04-22T19:12:51.845Z [err] stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
2020-04-22T19:12:51.845Z [err] gyp ERR! System Linux 4.15.0-96-generic
2020-04-22T19:12:51.845Z [err] gyp ERR!
2020-04-22T19:12:51.845Z [err]  command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/config/node-red/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/config/node-red/node_modules/canvas/build/Release" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
2020-04-22T19:12:51.845Z [err] gyp ERR! cwd /config/node-red/node_modules/canvas
2020-04-22T19:12:51.845Z [err] gyp 
2020-04-22T19:12:51.845Z [err] ERR! node -v v12.15.0
2020-04-22T19:12:51.845Z [err] gyp ERR! 
2020-04-22T19:12:51.845Z [err] node-gyp -v v5.0.5
2020-04-22T19:12:51.845Z [err] gyp
2020-04-22T19:12:51.845Z [err]  ERR! not ok 
2020-04-22T19:12:51.848Z [err] node-pre-gyp
2020-04-22T19:12:51.848Z [err]  ERR!
2020-04-22T19:12:51.848Z [err]  build error
2020-04-22T19:12:51.848Z [err]  
2020-04-22T19:12:51.849Z [err] node-pre-gyp
2020-04-22T19:12:51.849Z [err]  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=/config/node-red/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/config/node-red/node_modules/canvas/build/Release --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
2020-04-22T19:12:51.849Z [err] node-pre-gyp ERR! 
2020-04-22T19:12:51.849Z [err] stack     at ChildProcess.<anonymous> (/config/node-red/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
2020-04-22T19:12:51.849Z [err] node-pre-gyp 
2020-04-22T19:12:51.849Z [err] ERR! stack     at ChildProcess.emit (events.js:223:5)
2020-04-22T19:12:51.849Z [err] node-pre-gyp
2020-04-22T19:12:51.849Z [err]  ERR! stack
2020-04-22T19:12:51.849Z [err]      at maybeClose (internal/child_process.js:1021:16)
2020-04-22T19:12:51.849Z [err] node-pre-gyp 
2020-04-22T19:12:51.849Z [err] ERR! stack
2020-04-22T19:12:51.849Z [err]      at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
2020-04-22T19:12:51.849Z [err] node-pre-gyp
2020-04-22T19:12:51.849Z [err]  ERR! System Linux 4.15.0-96-generic
2020-04-22T19:12:51.849Z [err] node-pre-gyp
2020-04-22T19:12:51.849Z [err]  ERR! command "/usr/bin/node" "/config/node-red/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
2020-04-22T19:12:51.849Z [err] node-pre-gyp ERR!
2020-04-22T19:12:51.849Z [err]  cwd /config/node-red/node_modules/canvas
2020-04-22T19:12:51.849Z [err] node-pre-gyp ERR! node -v
2020-04-22T19:12:51.849Z [err]  v12.15.0
2020-04-22T19:12:51.849Z [err] node-pre-gyp ERR! 
2020-04-22T19:12:51.849Z [err] node-pre-gyp -v v0.11.0
2020-04-22T19:12:51.849Z [err] node-pre-gyp ERR! not ok 
2020-04-22T19:12:51.850Z [out] Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/config/node-red/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/config/node-red/node_modules/canvas/build/Release --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
2020-04-22T19:12:52.063Z [err] npm
2020-04-22T19:12:52.063Z [err]  ERR! code ELIFECYCLE
2020-04-22T19:12:52.063Z [err] npm 
2020-04-22T19:12:52.063Z [err] ERR! errno
2020-04-22T19:12:52.064Z [err]  1
2020-04-22T19:12:52.067Z [err] npm 
2020-04-22T19:12:52.067Z [err] ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
2020-04-22T19:12:52.067Z [err] npm ERR!
2020-04-22T19:12:52.067Z [err]  Exit status 1
2020-04-22T19:12:52.067Z [err] npm
2020-04-22T19:12:52.067Z [err]  ERR!
2020-04-22T19:12:52.067Z [err]  
2020-04-22T19:12:52.067Z [err] npm 
2020-04-22T19:12:52.067Z [err] ERR! Failed at the [email protected] install script.
2020-04-22T19:12:52.067Z [err] npm
2020-04-22T19:12:52.068Z [err]  ERR!
2020-04-22T19:12:52.068Z [err]  This is probably not a problem with npm. There is likely additional logging output above.
2020-04-22T19:12:52.175Z [err] 
2020-04-22T19:12:52.175Z [err] npm ERR! A complete log of this run can be found in:
2020-04-22T19:12:52.175Z [err] npm
2020-04-22T19:12:52.175Z [err]  ERR!
2020-04-22T19:12:52.176Z [err]      /root/.npm/_logs/2020-04-22T19_12_52_087Z-debug.log
2020-04-22T19:12:52.196Z rc=1

@tomtom30
Copy link
Author

Recently I have update to node-red 1.0.4, and it was ok in 0.20 version for me

@thebigpotatoe
Copy link
Owner

Failed at the [email protected] install script
node-pre-gyp: Permission denied

@tomtom30, seems like a canvas install issue, possibly due to either permissions or an unsupported architecture. By the looks of your other logs it seems as if you are running linux on a desktop?

Recently I have update to node-red 1.0.4, and it was ok in 0.20 version for me

Canvas does not rely on a version of node red. Did you also change your Node.js version as well? As the readme states, I only found one working combination of Node.js, tensroflow, and face-api.js that worked for me and a couple of others.

2020-04-22T19:12:49.677Z [err] Pre-built binaries not found for [email protected] and [email protected]

@dborsnich, again, incompatible versions of Node.js and canvas installed in your container.

@tomtom30
Copy link
Author

Iam running docker in swarm mode with node-red in single container on linux server 18.04.
But it is docker environment at all.
When I said : "I have update" it is " I have update docker image 0.20 to 1.04".

bash-5.0# npm install node-red-contrib-face-recognition

> [email protected] install /usr/src/node-red/node_modules/canvas
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request 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-v64-linux-musl-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI, musl) (falling back to source compile with node-gyp)
/bin/sh: 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/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Linux 4.15.0-55-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/usr/src/node-red/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/usr/src/node-red/node_modules/canvas/build/Release" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v64"
gyp ERR! cwd /usr/src/node-red/node_modules/canvas
gyp ERR! node -v v10.19.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/src/node-red/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/usr/src/node-red/node_modules/canvas/build/Release --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/usr/src/node-red/node_modules/canvas/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:982:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
node-pre-gyp ERR! System Linux 4.15.0-55-generic
node-pre-gyp ERR! command "/usr/local/bin/node" "/usr/src/node-red/node_modules/canvas/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/src/node-red/node_modules/canvas
node-pre-gyp ERR! node -v v10.19.0
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/src/node-red/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/usr/src/node-red/node_modules/canvas/build/Release --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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!     /root/.npm/_logs/2020-04-22T23_46_01_356Z-debug.log

I have done a new try.
I get a 404 error, It try to get

canvas-v2.6.1-node-v64-linux-musl-x64.tar.gz

which does not exist
Can I choose an another version of canvas?

@thebigpotatoe
Copy link
Owner

When I said : "I have update" it is " I have update docker image 0.20 to 1.04".

Forgive my ignorance, my docker knowledge is weak at best.

Can I choose an another version of canvas?

Not unless the binaries are built for you operating system. As you can see in the list of binaries from canvas prebuilt, canvas-v2.6.1-node-v64-linux-glibc-x64.tar.gz exists, but canvas-v2.6.1-node-v64-linux-musl-x64.tar.gz does not. So your version of linux is not supported by the library for a prebuilt download.

This doesn't mean however you cannot install canvas, you will just need to do it yourself. have a look at this thread over on the canvas page

@dborsnich
Copy link

I decide install node red directly to ubuntu server. There I have running docker and home assistant. I did a normal installation and works up to I decide to install tensor flow. It destroy the node red face rekonigtion and I will try to restart to last version. Tomorrow I'll update information. Thanks!

@thebigpotatoe
Copy link
Owner

No worries, sounds promising.

I really do hate the incompatibility of packages for this lib, but since face-api.js relies on canvas to work we are stuck with it until an alternative is found.

Let us know how you go.

@Phil1pp
Copy link

Phil1pp commented Jul 11, 2020

I also had problems using this Node on the docker container "nodered/node-red:latest" which is based on alpine linux.
I managed to get it working by installing some additional packages from the command line:
apk add --no-cache build-base g++ cairo-dev jpeg-dev pango-dev giflib-dev
apk add --update --repository http://dl-3.alpinelinux.org/alpine/edge/testing libmount ttf-dejavu ttf-droid ttf-freefont ttf-liberation ttf-ubuntu-font-family fontconfig
npm install canvas

@thebigpotatoe
Copy link
Owner

Thanks for the heads up. I just started using docker and linux this year for my own stuff and career, so I hope to eventually make this compatible with it out of the box. If you find any more commands that may help post them here.

Of course if you also have a docker file which is working for this also feel free to make a pull in the repo :)

@andriusign
Copy link

andriusign commented Jul 21, 2021

Adding these two lines to .gitlab-ci.yml fixed the problem:
image

apk add --no-cache build-base g++ cairo-dev jpeg-dev pango-dev giflib-dev
apk add --update --repository http://dl-3.alpinelinux.org/alpine/edge/testing libmount ttf-dejavu ttf-droid ttf-freefont ttf-liberation ttf-ubuntu-font-family fontconfig

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

No branches or pull requests

5 participants