Node.js 节点gyp生成致命错误:节点:没有此类文件或目录

Node.js 节点gyp生成致命错误:节点:没有此类文件或目录,node.js,node-gyp,Node.js,Node Gyp,我正在写一个节点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>

我正在写一个节点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);
然后我运行以下命令

$ node-gyp configure // OK
$ node-gyp build // Fail

gyp info it worked if it ends with ok
gyp info using node-gyp@2.0.1
gyp info using node@0.12.4 | 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

它缺少什么?

你不需要
#包括
,而不仅仅是
“节点”
?我认为问题是另一个问题是什么让你这么想?我的猜测来自错误中的这一行:
。/src/hello.cc:5:16:致命错误:节点:没有这样的文件或目录
。你是对的,我误解了来自build命令的消息
$ node-gyp configure // OK
$ node-gyp build // Fail

gyp info it worked if it ends with ok
gyp info using node-gyp@2.0.1
gyp info using node@0.12.4 | 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