I'm writing a node-gyp hello world
// src/hello.cc
#include "node"
#include "v8"
using namespace v8;
Handle<Value> Method(const Arguments& args) {
HandleScope scope;
return scope.Close(String::New("world"));
}
void init(Handle<Object> target) {
NODE_SET_METHOD(target, "hello", Method);
}
NODE_MODULE(hello, init);
.
// binding.gyp
{
"targets": [
{
"target_name": "hello",
"sources": [ "src/hello.cc" ]
}
]
}
Then I run the following commands
$ node-gyp configure // OK
$ node-gyp build // Fail
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/home/rkmax/hellogyp/build'
CXX(target) Release/obj.target/hello/src/hello.o
../src/hello.cc:5:16: fatal error: node: No such file or directory
compilation terminated.
hello.target.mk:85: recipe for target 'Release/obj.target/hello/src/hello.o' failed
make: *** [Release/obj.target/hello/src/hello.o] Error 1
make: Leaving directory '/home/rkmax/hellogyp/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/node-gyp/lib/build.js:269:23)
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 4.0.5-1-ARCH
gyp ERR! command "node" "/usr/bin/node-gyp" "build"
gyp ERR! cwd /home/rkmax/hellogyp
gyp ERR! node -v v0.12.4
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok
What it's missing?