I'm trying to integrate C++ with HTML using Electron and Node JS.But I'm confused by the NODE_MODULE_VERSION. I have a binding.gyp like examples.
{
"targets": [
{
"target_name": "addon",
"sources": [ "src/hello.cc" ],
"include_dirs": [
"<!(node -e \"require('nan')\")"
]
}
]
}
and a hello.cc
// hello.cc
#include <node.h>
namespace demo {
using v8::FunctionCallbackInfo;
using v8::Isolate;
using v8::Local;
using v8::Object;
using v8::String;
using v8::Value;
void Method(const FunctionCallbackInfo<Value>& args) {
Isolate* isolate = args.GetIsolate();
args.GetReturnValue().Set(String::NewFromUtf8(isolate, "world"));
}
void init(Local<Object> exports) {
NODE_SET_METHOD(exports, "hello", Method);
}
NODE_MODULE(addon, init)
} // namespace demo
and after node-gyp configure build,they run well with node
const addon = require('./package/build/Release/addon');
addon.hello();
But when I combined it with electron,there is something wrong.
I have read the APIs of both electron and nodejs.Some told me to install nvm to change nodejs's version,and others advice me to install electron-build.I tried,but they don't work.(I think it will be strange if they work). I think what's the matter is the version of nodejs.But my node is v7.7.4!So,how can i update the version of modules... thanks~