Lum*_*n75 3 macos homebrew canvas node.js npm
我正在尝试安装 captcha npm 模块,它利用 canvas 模块。
不幸的是我在 OSX 上安装该模块时遇到问题。我收到以下错误:
> canvas@1.0.4 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
Run Code Online (Sandbox Code Playgroud)
任何想法?显然缺少 ldconfig。但不知道如何安装。
我正在使用自制程序,并且安装了最新的 XCode 和命令行工具。
这是我的解决方法:
首先我们需要安装 cairo:
brew install cairo jpeg
Run Code Online (Sandbox Code Playgroud)
这需要一些时间。然而现在是时候更新 PKG_CONFIG_PATH 了,指向 cairo 库。
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/X11/lib/pkgconfig
Run Code Online (Sandbox Code Playgroud)
为了编译canvas,我们需要安装node-gyp。
npm install node-gyp -g
Run Code Online (Sandbox Code Playgroud)
如果由于缺少 jpeg lib 而安装仍然无法正常工作,您需要运行:
npm install canvas
Run Code Online (Sandbox Code Playgroud)
在需要它的项目目录中,然后在错误报告之前停止安装。然后你需要更改目录并手动重新编译 C++ 绑定
cd node_modules/canvas/
node-gyp rebuild
Run Code Online (Sandbox Code Playgroud)
之后你应该有工作画布模块。
| 归档时间: |
|
| 查看次数: |
1544 次 |
| 最近记录: |