我最近将我的系统上的nodejs版本从0.10.37更新到0.12.5,之后升级node-gyp重建失败了我使用的npm包之一。它给出了错误“ares.h”文件找不到。
这是我在构建时遇到的错误
CXX(target) Release/obj.target/ancillary/src/ancillary.o
In file included from ../src/ancillary.cc:4:
In file included from /Users//.node-gyp/0.12.2/src/stream_wrap.h:25:
/Users//.node-gyp/0.12.2/src/env.h:25:10: fatal error: 'ares.h' file not found
#include "ares.h"
^
1 error generated.
make: *** [Release/obj.target/ancillary/src/ancillary.o] Error 1
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:269:23)
gyp ERR! stack at ChildProcess.emit (events.js:110:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Darwin 14.3.0
gyp ERR! command "node" "/usr/local/bin/node-gyp" "rebuild"
gyp ERR! cwd /Users//src/node-ancillary
gyp ERR! node -v v0.12.2
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok
当我做npm版本时,我看到了
{ npm: '2.12.0',
http_parser: '2.3',
modules: '14',
node: '0.12.2',
openssl: '1.0.1m',
uv: '1.4.2-node1',
v8: '3.28.73',
zlib: '1.2.8' }
使用较早的nodejs版本
{ http_parser: '1.0',
node: '0.10.37',
v8: '3.14.5.9',
ares: '1.9.0-DEV',
uv: '0.10.36',
zlib: '1.2.8',
modules: '11',
openssl: '1.0.1l',
npm: '1.4.28' }
对于较新的版本,我没有看到npm版本结果中的ares包,我怀疑它是构建失败的问题。
如何摆脱上述构建错误?