我在 OS X Lion 上。我已经通过 Homebrew ( brew install yajl
) 安装了 libyajl。标头存在于/usr/local/include/yajl
:
scott @ scott-laptop : ~/Desktop
$ ls /usr/local/include/yajl
yajl_common.h yajl_gen.h yajl_parse.h yajl_tree.h yajl_version.h
scott @ scott-laptop : ~/Desktop
$ node -v
v0.8.5
scott @ scott-laptop : ~/Desktop
$ npm -v
1.1.46
但是在安装 Node 模块时出现错误:
scott @ scott-laptop : ~/Desktop
$ npm install yajl
npm http GET https://registry.npmjs.org/yajl
npm http 304 https://registry.npmjs.org/yajl
> yajl@0.6.1 install /Users/scott/Desktop/node_modules/yajl
> node-waf configure build
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for node path : ok /usr/local
Checking for node prefix : ok /usr/local
Checking for header yajl/yajl_version.h : not found
/Users/scott/Desktop/node_modules/yajl/wscript:20: error: Could not find yajl headers. Make sure libyajl development package is installed.
npm ERR! yajl@0.6.1 install: `node-waf configure build`
npm ERR! `sh "-c" "node-waf configure build"` failed with 1
npm ERR!
npm ERR! Failed at the yajl@0.6.1 install script.
npm ERR! This is most likely a problem with the yajl package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-waf configure build
npm ERR! You can get their info via:
npm ERR! npm owner ls yajl
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 11.4.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "yajl"
npm ERR! cwd /Users/scott/Desktop
npm ERR! node -v v0.8.5
npm ERR! npm -v 1.1.46
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/scott/Desktop/npm-debug.log
npm ERR! not ok code 0