nodejs-buildpack: Unable to re-build with node-oracledb dependency
I am running into an issue when using the buildpack version 1.5.15 and trying to use the node-oracledb module. in order to compile the native module it needs some oracle dependencies. I am getting the error below. I am struggling to figure out where I could customize the buildpack to install these dependencies. could someone guide me as to how I would customize the buildpack for this?
node-oracledb ERR! Error: Cannot find Oracle library libclntsh.so
node-oracledb ERR! Error: See https://github.com/oracle/node-oracledb/blob/master/INSTALL.md
gyp: Call to 'INSTURL="https://github.com/oracle/node-oracledb/blob/master/INSTALL.md"; ERR="node-oracledb ERR! Error:"; if [ -z $OCI_LIB_DIR ]; then OCI_LIB_DIR=`ls -d /usr/lib/oracle/*/client*/lib/libclntsh.* 2> /dev/null | tail -1 | sed -e 's#/libclntsh[^/]*##'`; if [ -z $OCI_LIB_DIR ]; then if [ -z "$ORACLE_HOME" ]; then if [ -f /opt/oracle/instantclient/libclntsh.so ]; then echo "/opt/oracle/instantclient/"; else echo "$ERR Cannot find Oracle library libclntsh.so" >&2; echo "$ERR See $INSTURL" >&2; echo "" >&2; fi; else if [ -f "$ORACLE_HOME/lib/libclntsh.so" ]; then echo $ORACLE_HOME/lib; else echo "$ERR Cannot find $ORACLE_HOME/lib/libclntsh.so" >&2; echo "$ERR See $INSTURL" >&2; echo "" >&2; fi; fi; else if [ -f "$OCI_LIB_DIR/libclntsh.so" ]; then echo $OCI_LIB_DIR; else echo "$ERR Cannot find $OCI_LIB_DIR/libclntsh.so" >&2; echo "$ERR See $INSTURL" >&2; echo "" >&2; fi; fi; else if [ -f "$OCI_LIB_DIR/libclntsh.so" ]; then echo $OCI_LIB_DIR; else echo "$ERR Cannot find $OCI_LIB_DIR/libclntsh.so" >&2; echo "$ERR See $INSTURL" >&2; echo "" >&2; fi; fi;' returned exit status 0 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/tmp/staged/app/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:305:16)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 3.19.0-51-generic
gyp ERR! command "/tmp/staged/app/.heroku/node/bin/node" "/tmp/staged/app/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /tmp/staged/app/node_modules/oracledb
gyp ERR! node -v v4.4.5
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
npm ERR! Linux 3.19.0-51-generic
npm ERR! argv "/tmp/staged/app/.heroku/node/bin/node" "/tmp/staged/app/.heroku/node/bin/npm" "rebuild" "--nodedir=/tmp/staged/app/.heroku/node"
npm ERR! node v4.4.5
npm ERR! npm v2.15.5
npm ERR! code ELIFECYCLE
npm ERR! oracledb@1.9.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the oracledb@1.9.3 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the oracledb package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs oracledb
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls oracledb
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /tmp/staged/app/npm-debug.log
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 17 (3 by maintainers)
Commits related to this issue
- add oracle env variables source: https://github.com/cloudfoundry/nodejs-buildpack/issues/65 — committed to christian-hofstetter/nodejs-buildpack by christian-hofstetter 8 years ago
@codeguruRahul
here are the changes I made to get this to work. I have listed the files and additions I made below.
lib/environment.sh
this is a function that will set up your environment variables for all of the oracle libraries
bin/compile.sh
add this line to the
create_env()function. this executes the function above with the paramteter for the build directoryadd this line to the top of the
build_dependencies()function. this executes the function that will install the actual oracle libraries.profile/nodejs.sh
add these into this file, i added them right after the
NODE_ENVis exported.lib/dependecies.sh
create this function, I did this at the top of the file, it should not matter where you put it. this is executed in the compile script, that we added above. you will need to replace the download urls with proper locations that you can access. I downloaded the instantclient-basic and sdk and put them, into artifactory.
you should be able to build the buildpack after this and it will bundle in the oracle libraries and npm will know about them.
let me know if there is anything that is not clear.