【问题标题】:'node-gyp' error in installing npm packages安装 npm 包时出现“node-gyp”错误
【发布时间】:2019-04-21 10:19:23
【问题描述】:

当我尝试通过 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,我已经在全球范围内安装了 zmqnode-gyp 然后它也一次又一次地给出同样的错误

这里发生了什么以及 node-gyp 实际上是什么

【问题讨论】:

  • 好吧,在打开包装并摆弄你的圣诞礼物之前,这是一个 NOT Reading the Fine Manual 的情况。那里非常清楚地说明了您应该做什么以及如何去做。

标签: node.js linux npm zeromq node-gyp


【解决方案1】:

尝试删除并重新安装:

sudo apt-get install libzmq-dev libzmq3-dev

npm install zeromq@5
pip install pyzmq

【讨论】:

    【解决方案2】:

    我遇到了同样的问题。尝试安装 zeromq 而不是 zmq。 Zmq 已弃用,您可以在此处查看:https://github.com/zeromq/zeromq.js/issues/123

    【讨论】:

      猜你喜欢
      • 2022-07-25
      • 1970-01-01
      • 2015-12-07
      • 1970-01-01
      • 2023-03-17
      • 2016-02-27
      • 1970-01-01
      • 2019-07-22
      • 1970-01-01
      相关资源
      最近更新 更多