当我尝试 npm install mosca 时,出现错误。
make: Entering directory
'/home/felix/Downloads/mqtts/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/felix/Downloads/mqtts/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/lib/node_modules/npm/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-46-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/felix/Downloads/mqtts/node_modules/zmq
gyp ERR! node -v v8.15.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN mqtts@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: zmq@2.15.3 (node_modules/zmq):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: zmq@2.15.3 install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
我尝试了不同的方法,例如删除 .node-gyp 和 .npmrc,但它不起作用。
节点:v8.15.0
npm:6.4.1