2013-10-29 52 views
3

我想安裝captcha npm模塊,它利用畫布模塊。畫布模塊編譯osx錯誤

不幸的是我有問題在OSX上安裝該模塊。 我收到以下錯誤:

> [email protected] install ....../node_modules/canvas 
> node-gyp rebuild 

not found: ldconfig 
gyp: Call to './util/has_lib.sh jpeg' returned exit status 0. 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/Cellar/node/0.10.21/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:424:16) 
gyp ERR! stack  at ChildProcess.EventEmitter.emit (events.js:98:17) 
gyp ERR! stack  at Process.ChildProcess._handle.onexit (child_process.js:789:12) 
gyp ERR! System Darwin 13.0.0 
gyp ERR! command "node" "/usr/local/Cellar/node/0.10.21/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" 
gyp ERR! cwd ...../node_modules/canvas 
gyp ERR! node -v v0.10.21 
gyp ERR! node-gyp -v v0.10.10 
gyp ERR! not ok 
npm ERR! weird error 1 

任何想法?顯然有ldconfig丟失。但不知道如何安裝它。

我正在使用自制軟件,並且安裝了最新的XCode和命令行工具。

回答

4

這是我的解決方法:

首先,我們需要安裝開羅:

brew install cairo jpeg 

這需要一段時間。但現在是時候更新PKG_CONFIG_PATH,指向cairo庫。

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig 

要編譯畫布,我們需要安裝node-gyp。

npm install node-gyp -g 

如果安裝仍不能正常工作,因爲缺少JPEG LIB的,你需要運行:

npm install canvas 

在需要的地方,然後就在錯誤報告之前停止安裝項目的目錄。然後,您需要更改目錄並手動重新編譯C++綁定

cd node_modules/canvas/ 
node-gyp rebuild 

之後,您應該有工作畫布模塊。

-1

據我所知,你需要安裝Get Xcode 6.1。

安裝Xcode和Xcode的命令行工具

同意Xcode的許可證在終端:sudo xcodebuild -license

您的OS X版本的安裝使用MacPorts: OS X 10.10約塞米蒂

https://www.macports.org/install.php