Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

when trying to configure or rebuild node-gyp, getting errors: mac osx mavericks

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?

like image 914
gabriella Avatar asked Jan 03 '14 20:01

gabriella


People also ask

What file does node gyp read the build?

gyp file describes the configuration to build your module, in a JSON-like format. This file gets placed in the root of your package, alongside package. json .

Why do I need node gyp?

node-gyp is a tool that enables the compilation of native add-on modules for Node in multiple platforms. It has widespread use and is included as a dependency in many NPM packages. On most systems, this isn't an issue, and installing node-gyp with the rest of your packages works as expected.


2 Answers

if in doubt first re-install npm install -g node-gyp.

It's best practice to run node-gyp rebuild. Run it from your project's root. Also your binding.gyp should be in the root, pointing to dependencies (somewhere else).

In general there shouldn't be any need to run node-gyp configure manually.

like image 41
eljefedelrodeodeljefe Avatar answered Sep 28 '22 10:09

eljefedelrodeodeljefe


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 
like image 149
h0x91B Avatar answered Sep 28 '22 11:09

h0x91B