building project

Issue #11 resolved
Aaron Bartell created an issue

I am trying to build this project and am curious about the instructions in the README.md.

Here is a mv command that is being done from what I ~assume~ is the root of the project.

mv src $Node_Install_Path/lib/node_modules/npm/bin/node-gyp-bin

The ./src folder contains .h and .cc files. Here is what I see when I display the contents of the destination directory:

ls /QOpenSys/QIBM/ProdData/OPS/Node6/lib/node_modules/npm/bin/node-gyp-bin
node-gyp      node-gyp.cmd

Are those instructions correct? I could just try it, but it is requiring me to "hose" my base install of Node.js (which I try not to touch).

Comments (6)

  1. mengxumx Account Deactivated

    Hello Aaron, The other way to compile the addon is --

    cd nodejs-idb-connector
    npm init
    npm i node-gyp
    node node_modules/node-gyp/bin/node-gyp.js configure
    node node_modules/node-gyp/bin/node-gyp.js build
    

    Then you will get the build/Release/db2ia.node

    This method will not touch anything of the base Node.js install. Actually Node.js contains the node-gyp tool as part of the npm tool, so I personally use that built-in one for build.

  2. mengxumx Account Deactivated

    The project has supported npm.js now. We can simply install the project by

    npm -g i idb-connector
    

    If your node program reports "Error: Cannot find module 'idb-connector'", you can set the NODE_PATH --

    export NODE_PATH=/QOpenSys/pkgs/lib/node_modules
    

    And you can build the local project as well --

    cd nodejs-idb-connector
    npm -g i
    

    @aaronbartell , shall we update the Wiki for the info?

  3. Bent Ronne

    Hi Xu Meng

    I think that I have tried all of the above but I receive this message when I try to run my node program:

    Error: Cannot find module '/xxx/js/node_modules/idb-connector/lib/binding/Release/node-v64-ibmi-ppc64/db2ia.node' Do you have any idea on how I can solve this problem?

    I’m running on an IBM i 7.3 using qsh:

    node -v v10.15.0 $
    npm -v
    6.4.1
    $

    Best regards Bent Ronne

  4. mengxumx Account Deactivated

    Hello Bent Ronne,

    Would you collect the full error message when run npm i idb-connector

  5. Bent Ronne

    Hello Xu Meng

    I have succeeded it to work for now by copying the missing directory from another “IBM i” partition. For the time being I have to focus on the project where I use IDB so I’m afraid to mess-up the installation right now. However, I found an installation log from one of the installations run of IDB and I hope this is good enough. Otherwise, please let me know and I will se what I can do.

    I can see from the log that the installation program installs .../node-v48-ibmi-pcc/... rather than .../node-v64-ibmi-ppc64/... so maybe there is something here to go for.

    npm install idb-connector                                                                                                       
      [K [?25h [37;40mnpm [0m  [0m [30;43mWARN [0m  [0m [35mlifecycle [0m The node binary used for scripts is /QOpenSys/usr/bin/node b
    ut npm is using /QOpenSys/pkgs/lib/nodejs8/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for
     the node binary npm was executed with.                                                                                           
      [0m                                                                                                                            
     > idb-connector@1.1.8 install /TBOX/node_modules/idb-connector                                                                   
     > node-pre-gyp install --fallback-to-build                                                                                      
    
      [37;40mnode-pre-gyp [0m  [0m [30;43mWARN [0m  [0m [35mUsing needle for node-pre-gyp https download [0m                          
      [0m[idb-connector] Success: "/TBOX/node_modules/idb-connector/lib/binding/Release/node-v48-ibmi-ppc/db2ia.node" is installed via
      remote                                                                                                                          
      [K [?25h [37;40mnpm [0m  [0m [30;43mWARN [0m  [0m [35msaveError [0m ENOENT: no such file or directory, open '/TBOX/package.json'
      [K [?25h [37;40mnpm [0m  [0m [30;43mWARN [0m  [0m [35menoent [0m ENOENT: no such file or directory, open '/TBOX/package.json're
     [0m [K                                                                                                                          
    
    
     [0m [37;40mnpm [0m  [0m [30;43mWARN [0m [35m [0m TBOX No description                              
     [0m [37;40mnpm [0m  [0m [30;43mWARN [0m [35m [0m TBOX No repository field.                        
     [0m [37;40mnpm [0m  [0m [30;43mWARN [0m [35m [0m TBOX No README data                              
     [0m [37;40mnpm [0m  [0m [30;43mWARN [0m [35m [0m TBOX No license field.                            
     [0m                                                                                               
    + idb-connector@1.1.8                                                                              
    updated 1 package and audited 1247 packages in 13.617s                                             
    found  [92m0 [0m vulnerabilities        
    
  6. Log in to comment