Node add-on with C++ on Windows 8
Question: I am trying to run basic code of "Hello World", while node Addon C++ way. None
of the stuff is different from wats the official standards of node addon
mentioned in the url <https://nodejs.org/api/addons.html>

I first created the **hello.cc** file which below mentioned code:-

    
    
    #include <node.h>
    #include <v8.h>
    
    using namespace v8;
    
    void Method(const v8::FunctionCallbackInfo<Value>& args) 
    {
        Isolate* isolate = Isolate::GetCurrent();
        HandleScope scope(isolate);
        args.GetReturnValue().Set(String::NewFromUtf8(isolate, "world"));
    }
    
    void init(Handle<Object> exports) 
    {
      NODE_SET_METHOD(exports, "hello", Method);
    }
    
    NODE_MODULE(hello, init)
    

The next part of the code shown below is binding.gyp which is the core file
used by node-gyp library which **in ideal world & successful outcomes, shall
generate a *.node file** which is the binary of C++ code inclusive google's
v8.h as well node.h as required files. You can relate this file something
similar to a *.so and *.dll file, in this its case *.node file and node
compiler is the consumer of it. The front end javascript communicates with
this file. Since Node is the common one, the whole arrangement works together
as one architecture. The binding.gyp is like JSON and contains the below
mentioned code:-

    
    
    {
       "targets": [
        {
           "target_name": "hello",
           "sources": [ "hello.cc" ]
        }
      ]
    }
    

All noders know the importance of package.json, just for quick understanding,
its master reference for node, which tells wats your stuff all about in node
world. The code for is mentioned below:-

    
    
    {
       "name": "hello",
       "version": "0.6.5",
       "description": "Node.js Addons Example #1",
       "main": "hello.js",
       "private": true,
        "scripts": {
             "test": "node hello.js"
        },
       "gypfile": true,
       "dependencies": {
            "bindings": "~1.2.1"
        }
     }
    

I am trying to run the whole different by pre-installing node-gyp using
command npm install -g node-gyp

The catch is below mentioned error when I am trying to build my code by first
running **node-gyp configure** followed by **node-gyp build** command:-

    
    
    C:\Node_Js_progs\addon_first>node-gyp configure
    gyp info it worked if it ends with ok
    gyp info using node-gyp@1.0.3
    gyp info using node@0.12.0 | win32 | ia32
    gyp ERR! configure error
    gyp ERR! stack Error: Can't find Python executable "python", you can set the  PYTHON env variable.
    gyp ERR! stack     at failNoPython (C:\Users\Devanjan\AppData\Roaming\npm\node_modules\node-gyp\lib\configure.js:103:14)
    gyp ERR! stack     at     C:\Users\Devanjan\AppData\Roaming\npm\node_modules\node-gyp\lib\configure.js:64:11
    gyp ERR! stack     at FSReqWrap.oncomplete (evalmachine.<anonymous>:99:15)
    gyp ERR! System Windows_NT 6.3.9600
    gyp ERR! command "node"    "C:\\Users\\Devanjan\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure"
    gyp ERR! cwd C:\Node_Js_progs\addon_first
    gyp ERR! node -v v0.12.0
    gyp ERR! node-gyp -v v1.0.3
    gyp ERR! not ok
    

Please help & guide, why I am not able to make a significant, since the idea
is to bridge **node & C++** which I have created as part of my work!


Answer: Node-gyp requires python 2.7 and visual studio 2010 or 2012 for compilation..
Note: VS is for windows user only ..

