我收到此错误:
/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
答案 0 :(得分:6)
这里有什么用......
使用 brew 安装 zmq :brew 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
答案 1 :(得分:0)
这是我的固定方法:
第1步:
brew install zmq
第2步:
export PKG_CONFIG_PATH=/usr/local/Cellar/zeromq/4.2.5/lib/pkgconfig/
(注意:以上路径中的zeromq版本4.2.5将需要更改为您安装的任何版本)
第3步:
sudo visudo
并添加
Defaults env_keep += "PKG_CONFIG_PATH"
步骤4:
在package.json>依赖项中,添加:
"zmq": "^2.15.3"
步骤5:
运行yarn
或npm install