node-gyp build致命错误:node:没有这样的文件或目录

时间:2015-06-24 13:35:23

标签: node.js node-gyp

我正在编写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" ]
    }
  ]
}

然后我运行以下命令

$ 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

它缺少什么?

0 个答案:

没有答案