Solvednode canvas node-gyp rebuild errror

make: *** [Release/obj.target/canvas/src/Canvas.o] Error 1
make: Leaving directory `/vagrant/node_modules/canvas/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
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)
gyp ERR! System Linux 3.2.0-23-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /vagrant/node_modules/canvas
gyp ERR! node -v v6.9.1
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm ERR! Linux 3.2.0-23-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "canvas"
npm ERR! node v6.9.1
npm ERR! npm  v3.10.8
npm ERR! code ELIFECYCLE

npm ERR! canvas@1.6.2 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the canvas@1.6.2 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the canvas package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs canvas
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls canvas
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /vagrant/npm-debug.log
vagrant@precise64:/vagrant$ make: *** [Release/obj.target/canvas/src/Canvas.o] Error 1^C

Issue or Feature

make: *** [Release/obj.target/canvas/src/Canvas.o] Error 1
make: Leaving directory `/vagrant/node_modules/canvas/build'

I think there are some error in the Canvas.o. But I don't know how to solve it

Your Environment

  • Version of node-canvas (e.g. 1.4.0): 1.6.2
  • Environment (e.g. node 4.2.0 on Mac OS X 10.8): Linux precise64 3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
20 Answers

✔️Accepted Answer

Hey, finally found the solution! I was having this error as well, what you have to do is download the dependencies first.
sudo apt-get install libcairo2-dev libjpeg8-dev libpango1.0-dev libgif-dev build-essential g++
After you finish that you would proceed with installing using npm install canvas

Related Issues:

98
node canvas "./util/has_lib.sh 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...
25
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 ...
24
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 ...
17
node canvas canvas installation issue
@ibnibraahim You need to install pkg-config brew install pkg-config edit: Actually if you read the r...
6
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...