NPM无法在OSX 10.9.5上安装zmq

我得到这个错误:

/bin/sh: pkg-config: command not found gyp: Call to 'pkg-config libzmq --libs' returned exit status 127. while trying to load binding.gyp 

我试过将nodejs升级到5.1.0。

我试过将nodejs降级到4.2.2。

我已经尝试完全删除nodejs手动然后重新安装4.2.2并再次尝试。

我已经尝试删除脚本在这里: https : //gist.github.com/brock/5b1b70590e1171c4ab54

然后重新安装每个版本并再次尝试。

我试过降级到zeromq 4.0.7。

没有运气。

这是完整的错误:

 localhost:~ user$ npm install zmq / > zmq@2.14.0 install /Users/user/node_modules/zmq > node-gyp rebuild /bin/sh: pkg-config: command not found gyp: Call to 'pkg-config libzmq --libs' returned exit status 127. 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:355:16) gyp ERR! stack at emitTwo (events.js:87:13) gyp ERR! stack at ChildProcess.emit (events.js:172:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12) gyp ERR! System Darwin 13.4.0 gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /Users/user/node_modules/zmq gyp ERR! node -v v4.2.2 gyp ERR! node-gyp -v v3.0.3 gyp ERR! not ok npm ERR! Darwin 13.4.0 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "zmq" npm ERR! node v4.2.2 npm ERR! npm v2.14.7 npm ERR! code ELIFECYCLE npm ERR! zmq@2.14.0 install: `node-gyp rebuild` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the zmq@2.14.0 install script 'node-gyp rebuild'. npm ERR! This is most likely a problem with the zmq package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node-gyp rebuild npm ERR! You can get their info via: npm ERR! npm owner ls zmq npm ERR! There is likely additional logging output above. npm ERR! Please include the following file with any support request: npm ERR! /Users/user/npm-debug.log 

这是什么工作…

使用brew install zmqbrew install zmq

export PKG_CONFIG_PATH=/usr/local/Cellar/zeromq/4.0.4/lib/pkgconfig/

sudo visudo

添加行Defaults env_keep += "PKG_CONFIG_PATH"

sudo npm install zmq