Flutterian
Flutterian

Reputation: 1781

Not able to install fabric.js on Mac OS

I am not able to install fabric js on mac os. Currently working on ionic project. Below is my project configuration

1. Ionic -v3

2. Angular - v6

3. Cordova

I ran below command on terminal

npm i fabric

But I got below error

Mobiles-MacBook-Pro:lib mobilesolution$ npm i fabric

> [email protected] install /usr/local/lib/node_modules/fabric/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
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:345:16)
gyp ERR! stack     at ChildProcess.emit (events.js:160:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:12)
gyp ERR! System Darwin 17.7.0
gyp ERR! command "/usr/local/Cellar/node/9.4.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/fabric/node_modules/canvas
gyp ERR! node -v v9.4.0
gyp ERR! node-gyp -v v3.7.0
gyp ERR! not ok 
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fabric/node_modules/canvas):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

+ [email protected]
added 82 packages from 192 contributors in 4.071s

I tried so many solutions but nothing is working. Even i tried to update the os version. Even though I found same issue.I tried below commands

cd /usr/local/lib sudo ln -s ../../lib/libSystem.B.dylib libgcc_s.10.5.dylib

sudo apt-get install build-essential
received error as apt-get not defined

apt-get remove gyp

xcode-select --install

sudo xcode-select --switch

node-gyp configure

sudo xcode-select -s /Library/Developer/CommandLineTools

softwareupdate --install -a

Upvotes: 1

Views: 685

Answers (1)

Flutterian
Flutterian

Reputation: 1781

I got the solution. I forgot to install cairo..

I followed this link to get the answer. Now its working fine. Able to install fabric.js

I ran below command..

brew install cairo
brew install pkg-config

Upvotes: 2

Related Questions