0
votes

I want to connect the oracle db via node js. For this, I tried to install node-oracledb module.

$ npm install oracle/node-oracledb#v3.1.2

This throws below error messages.

[email protected] install C:\Users\Desktop\WebApp\node-oracle-db\node_modules\oracledb node-gyp rebuild

C:\Users\Desktop\WebApp\node-oracle-db\node_modules\oracledb>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild ) 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 PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19) gyp ERR! stack at PythonFinder. (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16) gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29 gyp ERR! stack at FSReqWrap.oncomplete (fs.js:166:21) gyp ERR! System Windows_NT 10.0.14393 gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild" gyp ERR! cwd C:\Users\Desktop\WebApp\node-oracle-db\node_modules\oracledb gyp ERR! node -v v9.5.0 gyp ERR! node-gyp -v v3.6.2 gyp ERR! not ok npm WARN [email protected] No description npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR!
C:\Users\AppData\Roaming\npm-cache_logs\2019-04-09T06_36_44_005Z-debug.log

I dont understand why do I need to have python dependency to connect with oracle db? and how to do so?

2

2 Answers

0
votes

Node is built using GYP which uses python. I think that is why you are getting this error. Although to run Nodejs apps you do not need python at all. Maybe this would be a requirement for this particular package. You are specifying a version of node oracle-db which needs python to be installed.

You can run the following to resolve your issue

npm install oracledb

This should not give you the error you are facing.

If this does not work you can follow the below

You can run the following to resolve the issue you are running into.

npm install --global --production windows-build-tools

This is going to install python on your system.

Then you can install gyp globally

npm install node-gyp

Then maybe you can install the specific version you are looking for node-oracledb

0
votes

to connect the oracle db via node js,run

npm install oracledb