Solvednode canvas "./util/ freetype" returned exit status 0 in Canvas 1.6.0

After updating to 1.6.0 on Ubuntu 16.04, i'm now recieving the following error:

$ npm i canvas

> canvas@1.6.0 install /home/kurisu/sherlock/node_modules/canvas
> node-gyp rebuild

grep: warning: GREP_OPTIONS is deprecated; please use an alias or script
gyp: Call to './util/ freetype' returned exit status 0 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:305:16)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)

I previously had Canvas 1.5.0 installed, all the dependencies (through apt) are met, but after trying to install 1.6.0, now I can't even return to 1.5.0.


Ubuntu 16.04 LTS Server
Canvas 1.6.0
Node 6.5.0

16 Answers

✔️Accepted Answer

Fixed on my machine (OSX) with:

npm install -g node-gyp
brew install pkg-config cairo libpng jpeg giflib

Other Answers:

It sounds like one or more of your dependencies got borked. Might try re-running the install bit (sudo apt-get install libcairo2-dev libjpeg8-dev libpango1.0-dev libgif-dev build-essential g++)... If that doesn't do it, there are a handful of issues in this repo with the same or similar error that might have useful things to try.

I think that the actual problem was that you had GREP_OPTIONS set. sudo shouldn't be a requirement and I would not recommend building with sudo.

The only reason it started working with sudo is that it clears the environment.

This could be fixed by converting from sh to javascript.

Related Issues:

node canvas "./util/ freetype" returned exit status 0 in Canvas 1.6.0
Fixed on my machine (OSX) with: After updating to 1.6.0 on Ubuntu 16.04 i'm now recieving the follow...
node canvas node-gyp rebuild errror
Hey finally found the solution! I was having this error as well what you have to do is download the ...
node canvas npm ERR! Failed at the canvas@1.4.0 install script 'node-gyp rebuild'
For OSX I had to do this: I am trying to deploy my app to digitalocean with dokku ...
node canvas canvas installation issue
@ibnibraahim You need to install pkg-config brew install pkg-config edit: Actually if you read the r...
node canvas node-canvas cannot be built on Heroku.
(I wasn't sure if it would be better for me to create a new issue for this Issue or Feature node-can...