Skip to content

Instantly share code, notes, and snippets.

@simeg
Last active August 17, 2022 13:40
Show Gist options
  • Save simeg/b2011f13bc7e415c26fea14a2a404fb3 to your computer and use it in GitHub Desktop.
Save simeg/b2011f13bc7e415c26fea14a2a404fb3 to your computer and use it in GitHub Desktop.
How to install canvas package

For OS X 10.12

If you get this error when installing the npm package canvas

$ npm install canvas

npm WARN gentlyRm not removing /Users/simon/repos/mac-setup/node_modules/.bin/rimraf as it wasn't installed by /Users/simon/repos/mac-setup/node_modules/rimraf

> canvas@1.6.6 install /Users/simon/repos/mac-setup/node_modules/canvas
> node-gyp rebuild

./util/has_lib.sh: line 31: pkg-config: command not found
gyp: Call to './util/has_lib.sh freetype' returned exit status 0 while in binding.gyp. while trying to load binding.gyp
...

Resolve it by installing these packages

$ npm install -g node-gyp
$ brew install pkg-config cairo libpng jpeg giflib
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment