当我尝试通过npm安装“ zmq”时出现此错误
oem@saurabh:~/Desktop/watcher/messaging$ npm install zmq
> zmq@2.15.3 install /home/oem/Desktop/watcher/messaging/node_modules/zmq
> node-gyp rebuild
make: Entering directory '/home/oem/Desktop/watcher/messaging/node_modules/zmq/build'
CXX(target) Release/obj.target/zmq/binding.o
../binding.cc:28:10: fatal error: zmq.h: No such file or directory
#include <zmq.h>
^~~~~~~
compilation terminated.
zmq.target.mk:101: recipe for target 'Release/obj.target/zmq/binding.o' failed
make: *** [Release/obj.target/zmq/binding.o] Error 1
make: Leaving directory '/home/oem/Desktop/watcher/messaging/node_modules/zmq/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.15.0-39-generic
gyp ERR! command "/usr/bin/node" "/usr/local/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/oem/Desktop/watcher/messaging/node_modules/zmq
gyp ERR! node -v v8.10.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN messaging@1.0.0 No description
npm WARN messaging@1.0.0 No repository field.
npm ERR! Linux 4.15.0-39-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "zmq"
npm ERR! node v8.10.0
npm ERR! npm v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! zmq@2.15.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the zmq@2.15.3 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, 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 information on how to open an issue for this project with:
npm ERR! npm bugs zmq
npm ERR! Or if that isn't available, 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! /home/oem/Desktop/watcher/messaging/npm-debug.log
我正在使用linux,我已经全局安装了 zmq 和 node-gyp ,所以它一次又一次地给出相同的错误
这里发生了什么,实际上是node-gyp
答案 0 :(得分:1)
我有同样的问题。尝试安装zeromq而不是zmq。 Zmq已弃用,您可以在此处检查:https://github.com/zeromq/zeromq.js/issues/123