本文介绍了尝试配置或重建node-gyp时,出现错误:mac osx mavericks的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行node-gyp configure,但是出现以下错误:

gyp: binding.gyp not found (cwd: /usr/local/bin)
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/node-gyp/lib/configure.js:337:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Darwin 13.0.0
gyp ERR! command "node" "/usr/local/bin/node-gyp" "configure"
gyp ERR! cwd /usr/local/bin
gyp ERR! node -v v0.10.20
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok

我认为我在错误的目录中,但是不确定.我应该在哪个目录中运行它?

解决方案

您正在尝试在当前工作目录(CWD)/usr/local/bin中运行node-gyp rebuild,因此node-gyp/usr/local/bin/binding.gyp上找不到绑定./p>

将您的终端导航到包含NodeJS模块的目录,然后运行node-gyp rebuild.

cd ~/Projects/your-nodejs-native-module/
node-gyp rebuild

顺便说一句,我不确定确切从哪个节点版本开始,但是在现代版本中,您只需在此目录中运行npm install,npm就会为您运行node-gyp rebuild.

cd ~/Projects/your-nodejs-native-module/
npm install

I'm trying to run node-gyp configure, but am getting the following errors:

gyp: binding.gyp not found (cwd: /usr/local/bin)
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/node-gyp/lib/configure.js:337:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Darwin 13.0.0
gyp ERR! command "node" "/usr/local/bin/node-gyp" "configure"
gyp ERR! cwd /usr/local/bin
gyp ERR! node -v v0.10.20
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok

I think that I'm in the wrong directory, but I'm not sure. Which directory should I be in to run this?

解决方案

You are trying to run node-gyp rebuild in current working directory (CWD) /usr/local/bin so the node-gyp can not find binding at /usr/local/bin/binding.gyp.

Navigate your terminal to a directory which contains NodeJS module and only then run node-gyp rebuild.

cd ~/Projects/your-nodejs-native-module/
node-gyp rebuild

BTW I am not sure from which node version exactly but in modern versions, you can just run npm install in this directory and npm will run node-gyp rebuild for you.

cd ~/Projects/your-nodejs-native-module/
npm install

这篇关于尝试配置或重建node-gyp时,出现错误:mac osx mavericks的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 03:22