Hello,
I'm trying to install oracledb on a Fedora machine that has oracle 12c (12.1.0.2) and nodejs v4.2.1 node-gyp -v v3.0.3 installed on it. I'm installing from user oracle. Relevant info:
echo $ORACLE_HOME
/u01/app/oracle/product/12.1.0.2/db_1
stat $OCI_LIB_DIR/libclntsh.so
File: '/u01/app/oracle/product/12.1.0.2/db_1/lib/libclntsh.so' -> '/u01/app/oracle/product/12.1.0.2/db_1/lib/libclntsh.so.12.1'
Size: 59 Blocks: 0 IO Block: 4096 symbolic link
Device: b8h/184d Inode: 41739121 Links: 1
Access: (0777/lrwxrwxrwx) Uid: (54321/ oracle) Gid: (54321/oinstall)
Access: 2016-01-05 19:00:03.334203482 -0500
Modify: 2015-11-20 16:59:42.778155921 -0500
Change: 2015-11-20 16:59:42.778155921 -0500
Birth: -
error is below, is given when i run the command sudo -E npm install oracledb
Any idea what the problem might be? The output is below:
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 trying to load binding.gyp
What's OCI_INC_DIR set to?
Check sudo -E actually preserves the environment variables?
Did you consider setting FORCE_RPATH=1 during installation so you don't need LD_LIBRARY_PATH set to run Node? See https://github.com/oracle/node-oracledb/blob/master/INSTALL.md#forcing-rpath
Ok now I switched to using user oracle, running this command:
sudo --preserve-env npm install oracledb
[oracle@fedora data_collection]$ sudo --preserve-env echo $OCI_LIB_DIR
/u01/app/oracle/product/12.1.0.2/db_1/lib
[oracle@fedora data_collection]$ sudo --preserve-env echo $OCI_INC_DIR
/u01/app/oracle/product/12.1.0.2/db_1/rdbms/public
[oracle@fedora data_collection]$ sudo --preserve-env echo $ORACLE_HOME
/u01/app/oracle/product/12.1.0.2/db_1
Also running python v2.7.5
Also same error with `FORCE_RPATH=1 sudo --preserve-env npm install oracledb
I have no idea what to try next, except maybe switching versions of node.
Have you tried 'sudo su -' and then setting the environment variables in the resulting shell?
In general when creating binaries that reference an $ORACLE_HOME, make sure that anyone who invokes those binaries has access to $ORACLE_HOME. Traditionally you need to chmod the oracle home directory permissions.
Since you are have $ORACLE_HOME set, you shouldn't need to have OCI_*_DIR set. See https://github.com/oracle/node-oracledb/blob/master/INSTALL.md#linuxadv
Hi cjbj, thanks for your help. I kind of realized that the client libs were only supposed to be needed when oracle 12c was not installed on the machine. Anyways, my halfway implementation of that may have been the problem. I went ahead and installed 'SDK' RPMs (I already had the client libs installed), and install worked! I'm not sure what I was doing wrong, since I do have a full Oracle 12c installation on the server, and so I shouldn't have needed to do that. But it worked, so I'm happy with that!
I had same issue. Setting Env variable works for me.
$ export OCI_LIB_DIR=/home/gdev/Software/instantclient_12_1
$ export OCI_INC_DIR=/home/gdev/Software/instantclient_12_1/sdk/include
$ npm install oracledb
Most helpful comment
I had same issue. Setting Env variable works for me.