How can I ovecome this error in npm install?

Solution 1:

First Try installing the binaries for canvas mentioned in https://github.com/Automattic/node-canvas

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

Then install canvas:

npm install canvas

Solution 2:

Did you start by running npm init? I would assume so because of the node_modules folder mentioned in the error, but just checking.

You can install it with homebrew using:

brew install pkg-config cairo pango libpng jpeg giflib librsvg

according to the docs here: https://github.com/Automattic/node-canvas