npm install xml2json无法安装

时间:2014-01-15 15:57:05

标签: macos node.js

我正在尝试使用node.js处理Android / ios的PUSh通知。 我尝试安装xml2json时收到以下错误。  请帮我解决一下

gyp ERR! build error 
gyp ERR! stack Error: not found: make
gyp ERR! stack     at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:43:28)
gyp ERR! stack     at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:46:29)
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/which.js:57:16
gyp ERR! stack     at Object.oncomplete (fs.js:107:15)
gyp ERR! System Darwin 12.5.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/bertils/node_modules/xml2json/node_modules/node-expat
gyp ERR! node -v v0.10.24
gyp ERR! node-gyp -v v0.12.1
gyp ERR! not ok 
npm ERR! node-expat@2.0.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-expat@2.0.0 install script.
npm ERR! This is most likely a problem with the node-expat 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-expat
npm ERR! There is likely additional logging output above.

npm ERR! System Darwin 12.5.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "xml2json"
npm ERR! cwd /Users/bertils
npm ERR! node -v v0.10.24
npm ERR! npm -v 1.3.21
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/bertils/npm-debug.log
npm ERR! not ok code 0

2 个答案:

答案 0 :(得分:1)

您的系统上似乎没有make工具。

要解决此问题,您有两个选择:

  • 如果您已安装Xcode

转到Xcode > Preferences > Downloads并安装名为“命令行工具”的组件。所有相关工具都将放在/usr/bin

  • 替代:

转到https://developer.apple.com/downloads,使用您的开发者Apple ID登录并搜索“命令行工具”,然后下载并安装相应的文件。

答案 1 :(得分:0)

我在linux rhel 7上也遇到了同样的问题,看看它是否适合你,我发现我需要在我的实例上安装gcc库,所以我继续删除了我的node_modules文件夹然后运行sudo yum group install "Development Tools",在您的情况下,您可能希望找到brew等效sudo yum group install "Development Tools"xcode-select --install,然后我再次运行npm install并且它有效!

希望这有帮助,对于与安装gcc库和开发工具相关的问题,也可以参考此网址:Install gcc and dev toolsMac OS install dev tools