无法在Mac OS上安装fabric.js

时间:2018-08-02 02:40:02

标签: command-line ionic3 fabricjs angular6 node-gyp

我无法在Mac OS上安装Fabric JS。目前正在从事离子项目。下面是我的项目配置

1。离子-v3

2。 Angular-v6

3。科尔多瓦

我在终端上运行了以下命令

  

npm i面料

但是我遇到了错误

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

> canvas@1.6.11 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: canvas@1.6.11 (node_modules/fabric/node_modules/canvas):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: canvas@1.6.11 install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

+ fabric@2.3.3
added 82 packages from 192 contributors in 4.071s

我尝试了很多解决方案,但是没有任何效果。即使我试图更新操作系统版本。即使我发现了同样的问题。我还是尝试了以下命令

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

1 个答案:

答案 0 :(得分:2)

我找到了解决方案。我忘了安装cairo。.

我点击了this链接以获得答案。现在工作正常。能够安装fabric.js

我在命令下跑了。

brew install cairo
brew install pkg-config