IBM / nodejs-idb-connector

A JavaScript (Node.js) library for communicating with Db2 for IBM i, with support for queries, procedures, and much more. Uses traditional callback-style syntax
MIT License
37 stars 23 forks source link

Problem installing idb-connector #63

Closed GautierFR closed 5 years ago

GautierFR commented 5 years ago

Hello,

I am trying to install idb-connector to execute SQL queries on DB2 (IBM i V7R2). My npm is in version 6.4.1, and node in version 10.15.0. And I'm having a problem. Here is the log debug generated during install process. Thank you in advance for your help. 2019-03-04T13_49_38_994Z-debug.log

kadler commented 5 years ago

Why are you running the npm install from /QOpenSys/pkgs/bin?

GautierFR commented 5 years ago

Sorry, it was just my last test. From my test application (SQLquerySample), I have this log file. 2019-03-04T16_37_43_480Z-debug.log

I don't have package.json for my test application. Is it mandatory to install the idb-connector ? Sorry for my questions, I am a beginner in node.js.

Thank you for your quick answer !

kadler commented 5 years ago

No, it's not required - it's just a warning. The problem is here:

1156 verbose stack Error: idb-connector@1.1.9 install: `node-pre-gyp install --fallback-to-build`
1156 verbose stack spawn ENOENT
1156 verbose stack     at ChildProcess.<anonymous> (/QOpenSys/pkgs/lib/nodejs10/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
1156 verbose stack     at ChildProcess.emit (events.js:182:13)
1156 verbose stack     at maybeClose (internal/child_process.js:962:16)
1156 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
1157 verbose pkgid idb-connector@1.1.9
1158 verbose cwd /www/NodeJs10/SQLquerySample
1159 verbose OS400 7.2
1160 verbose argv "/QOpenSys/pkgs/lib/nodejs10/bin/node" "/QOpenSys/pkgs/bin/npm" "i" "idb-connector"
1161 verbose node v10.15.0
1162 verbose npm  v6.4.1

The problem is that it's falling back to building the package instead of downloading the pre-built. I think this is something for @dmabupt or @abmusse to look at.

abmusse commented 5 years ago

@GautierFR

Few lines standout from the log file:

1139 warn lifecycle npm is using /QOpenSys/pkgs/lib/nodejs10/bin/node but there is no node binary in the current PATH. Use the--scripts-prepend-node-pathoption to include the

1141 verbose lifecycle idb-connector@1.1.9~install: PATH: /QOpenSys/pkgs/lib/nodejs10/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/www/NodeJs10/SQLquerySample/node_modules/idbconnector/node_modules/.bin:/www/NodeJs10/SQLquerySample/node_modules/.bin:/QOpenSys/usr/bin:/usr/ccs/bin:/QOpenSys/usr/bin/X11:/usr/sbin:.:/usr/bin 1142 verbose lifecycle idb-connector@1.1.9~install: CWD: /www/NodeJs10/SQLquerySample/node_modules/idb-connector

I suspect this issue is related to your PATH. Looks like /QOpenSys/pkgs/bin is not on your path.

run echo $PATH and post your output.

It could be using an older OPS version of node from /QOpenSys/usr/bin.

You can try appending /QOpenSys/pkgs/bin to your path with:

PATH=/QOpenSys/pkgs/bin:$PATH

GautierFR commented 5 years ago

Thank you very much. It was the path problem. With PATH=/QOpenSys/pkgs/bin:$PATH in CALL QP2TERM, I get the right installation

  • idb-connector@1.1.9
    added 67 packages from 29 contributors and audited 98 packages in 15.286s found [92m0 [0m vulnerabilities
abmusse commented 5 years ago

@GautierFR

Glad that solved your problem. One thing to note is that the above only sets the PATH for your current session. If you want to add /QOpenSys/pkgs/bin to your PATH permanently you can add it to your .profile file see the docimentation here