Tuesday 16 May 2017

Uncaught Error : error 1114 in electron

I'm making a simple hello world application on electron using native C++, but getting this "Uncaught Error : error 1114" error. This error is specifically when project runs on windows whereas it works good on fedora.

Following is the detail :-

Uncaught Error : error 1114 in electron

Pakage.json

{
"name": "nodec",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "electron ."
},
"author": "",
"license": "ISC",
"devDependencies": {
"electron-packager": "^8.7.0"
}
}

binding.gyp
{
"targets": [
{
"target_name": "addon",
"sources": [ "addon.cc" ]
}
]
}

3.addon.cc

#include <node.h>
namespace demo {
using v8::Exception;
using v8::FunctionCallbackInfo;
using v8::Isolate;
using v8::Local;
using v8::Number;
using v8::Object;
using v8::String;
using v8::Value;

void hello(const FunctionCallbackInfo& args) {
Isolate* isolate = args.GetIsolate();

args.GetReturnValue().Set(String::NewFromUtf8(isolate,"world"));
}

void Init(Local exports) {
NODE_SET_METHOD(exports, "hello", hello);
}

NODE_MODULE(addon, Init)
}

main.js

const addon = require('./build/Release/addon');
console.log('This should be eight:', addon.hello());

index.html

<title>My C++ App</title> Hello <script> require('./main.js') </script>

I have configured and build the project several times but that doesn't seem to be helpful in this case. Please help me to know where is the mistake.



via Mind Tech

No comments:

Post a Comment