Gulp issues with cario install command not found when trying to installing canvas

筅森魡賤 提交于 2019-12-06 02:21:12

I had this issue as well. I had also used brew to install cairo and quartz. I followed these instructions here and most specifically this step fixed my issue.

export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig

Make sure that you add this to your .bashrc or .zshrc if you want it to persist across sessions. I deleted my node_modules directory after successfully compiling and tried to npm install again in a new terminal session and I had to re-export that PKG_CONFIG_PATH to allow it to compile properly again.

Here is my output abbreviated to demonstrate.

$ npm install
> node-gyp rebuild
Package xcb-shm was not found in the pkg-config search path.
Perhaps you should add the directory containing `xcb-shm.pc'
to the PKG_CONFIG_PATH environment variable
Package 'xcb-shm', required by 'cairo', not found
gyp: Call to './util/has_cairo_freetype.sh' returned exit status 0. while trying to load binding.gyp
gyp ERR! configure error
...

$ export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig
$ npm install                            

$ canvas@1.1.3 install $HOME/projects/canvas/node_modules/canvas
$ node-gyp rebuild
...
Successful Compile

npm start worked without errors at this point

I hope this helps anyone else that runs into this.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!