繁体   English   中英

安装节点模块时 node-gyp 重建失败

[英]node-gyp rebuild fails while installing node modules

我正在尝试在节点 0.12 中安装 node_xslt 模块,但它失败了。 我有 python 2.7 版和 node-gyp 2.0.2 版。

这是错误堆栈-

> node_xslt@0.1.9 preinstall /home/ritesh/Ritesh/projects/applane1/node_modules/node_xslt
> node-gyp rebuild

/bin/sh: 1: xml2-config: not found
gyp: Call to 'xml2-config --cflags' 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:343:16)
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 Linux 3.13.0-32-generic
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/ritesh/Ritesh/projects/applane1/node_modules/node_xslt
gyp ERR! node -v v0.12.4
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok 
npm ERR! Linux 3.13.0-32-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "node_xslt"
npm ERR! node v0.12.4
npm ERR! npm  v2.10.1
npm ERR! code ELIFECYCLE

npm ERR! node_xslt@0.1.9 preinstall: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node_xslt@0.1.9 preinstall script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the node_xslt 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 node_xslt
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /node_modules/npm-debug.log

安装其他模块时也会出现此错误,即 xslt4node。

刚刚遇到了同样的问题,虽然这个问题已经有 5 年以上的历史了,但可能对其他人有用。 我解决了使用 nvm 切换到不同版本节点的问题:在我的情况下, nvm use 12

尝试安装编译工具

sudo apt-get install python3 g++ make python3-pip 

适合我

尝试安装sudo apt-get install libxml2-dev

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM