Automattic / node-canvas

Node canvas is a Cairo backed Canvas implementation for NodeJS.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't install canvas on Node v14.7.0 (Debian 4.9.228-1)

zptr1 opened this issue · comments

commented

Issue or Feature

Installing node-canvas on Node v14.7.0 failing with this error:

101 verbose stack Error: canvas@2.6.1 install: `node-pre-gyp install --fallback-to-build`
101 verbose stack Exit status 126
101 verbose stack     at EventEmitter.<anonymous> (/home/artem/.nvm/versions/node/v14.7.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
101 verbose stack     at EventEmitter.emit (events.js:314:20)
101 verbose stack     at ChildProcess.<anonymous> (/home/artem/.nvm/versions/node/v14.7.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
101 verbose stack     at ChildProcess.emit (events.js:314:20)
101 verbose stack     at maybeClose (internal/child_process.js:1051:16)
101 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
102 verbose pkgid canvas@2.6.1
103 verbose cwd /home/artem/sjs
104 verbose Linux 4.9.0-13-amd64
105 verbose argv "/home/artem/.nvm/versions/node/v14.7.0/bin/node" "/home/artem/.nvm/versions/node/v14.7.0/bin/npm" "i"
"canvas"
106 verbose node v14.7.0
107 verbose npm  v6.14.7
108 error code ELIFECYCLE
109 error errno 126
110 error canvas@2.6.1 install: `node-pre-gyp install --fallback-to-build`
110 error Exit status 126
111 error Failed at the canvas@2.6.1 install script.
111 error This is probably not a problem with npm. There is likely additional logging output above.
112 verbose exit [ 126, true ]

I tried to use sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev but it doesn't helped, i still getting this same error.

Your Environment

  • Node v14.7.0, npm v6.14.7, Linux nothing-interesting 4.9.0-13-amd64 #1 SMP Debian 4.9.228-1 (2020-07-05) x86_64 GNU/Linux

Hello,
i have same problem, docker image node:14.0-buster with node 14
Error by installation:
fresh packages...
error /node_modules/canvas: Command failed.

node-pre-gyp ERR! Completion callback never invoked!
node-pre-gyp ERR! System Linux 4.15.0-112-generic

node-pre-gyp ERR! node -v v14.0.0
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! This is a bug in node-pre-gyp.
node-pre-gyp ERR! Try to update node-pre-gyp and file an issue if it does not help:
node-pre-gyp ERR! https://github.com/mapbox/node-pre-gyp/issues

downgrade to node 12.18 helped, but i need node 14

I am seeing this too!

Issue still exists May 29th, 2021 in case anyone is wondering.

Unfortunately, from my testing it doesn't install in node 12.18 either (Ubuntu Server tested, not Debian)

I tried node 12.18.4 and 12.18.0, both with the --cache /tmp parameter to avoid repo caching on the system.

I have not found a version of Node that this package installs on yet for Ubuntu Server 20

Just an update: for me this was a case of RTFM,

When I was about to create a new issue, I saw information in the entry field about looking here if having issues installing:

https://github.com/Automattic/node-canvas#installation

This information helped me. I installed the packages it mentioned for Ubuntu and subsequent npm installs, while still throwing the package fetch error, would then continue to automatically build from soure.

All versions of Node I mentioned earlier work now.

I cannot vouch for Debian systems, but since Ubuntu is Debian based, it's maybe worth a shot (though it seems OP did in fact try this)

Exit status 126

That suggests a permissions error. There's no enough info here to troubleshoot further, but will reopen if more info is provided.