nodejs / node-gyp

Node.js native addon build tool
MIT License
9.87k stars 1.79k forks source link

"v8.h file not found" when node-gyp build #162

Closed yiyangest closed 10 years ago

yiyangest commented 11 years ago

I am using node-gyp build to build a native addon for nodejs, but it results an build error called v8.h not found.

../src/scws.cc:1:10: fatal error: 'v8.h' file not found

include <v8.h>

     ^

1 error generated. make: *\ [Release/obj.target/node_scws/src/scws.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:236:23) gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:99:17) gyp ERR! stack at Process._handle.onexit (child_process.js:678:10) gyp ERR! System Darwin 12.2.0

And I checked the /usr/local/include path, it has the link to the v8.h.

The node version is v0.8.14, installed from homebrew.

The node-gyp version is v0.7.1.

The OS is Mac OS X 10.8.2

vertexclique commented 11 years ago

+1 from MacOS 10.8.2

karlwestin commented 11 years ago

I had exactly the same problem, on exactly the same OS. After reading up a little, i found #89 and #105, which pointed me in the right direction. What i did was to download the node source again, and copy all the stuff into ~/.node-gyp/0.8.18/ (the place that node-gyp configure sets as node_root_dir). After doing that, I could build again.

I'm gonna look further into what actually gets downloaded when first running node-gyp. To me, the problem seems to be there. Any other theories?

Edit: I tried reproducing the problem, and i couldn't. My theory is: When i first tried to run node-gyp configure, i was on a very sketchy connection. Could it be that the tar wasn't finished downloading? I tried to simulate this using node-gyp install --dist-url http://localhost:8000, serving up the tar from a local server. I was only able to interrupt the connection without node-gyp install throwing an error once, so if the problem was the half-finished download, it seems pretty rare.

dpatti commented 11 years ago

i was on a very sketchy connection

This was the tip-off for me. I had just installed node v0.9.12 from v0.8.8, and then did npm install for the first time while on a bus using their less-than-perfect internet. Turns out, my ~/.node-gyp/0.9.12/ directory only had a tools directory and not a deps and src like it should have. Simply deleting the directory and re-running npm install fixed my problem.

Additionally, I am using Ubuntu 13.04, so it does not seem to be OS-dependent.

JayBeavers commented 10 years ago

Does not seem to be related to the build system itself, closing.