3

I follow all the instructions to install node oracle on my computer. When I run sudo npm install oracle (or without sudo) I get:

../src/connection.h:11:10: fatal error: 'occi.h' file not found

    #include <occi.h>
         ^
1 error generated.
make: *** [Release/obj.target/oracle_bindings/src/connection.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:810:12)
gyp ERR! System Darwin 14.0.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/alexanderkornhauser/node_modules/oracle
gyp ERR! node -v v0.10.33
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok 

npm ERR! oracle@0.3.7 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the oracle@0.3.7 install script.
npm ERR! This is most likely a problem with the oracle 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 their info via:
npm ERR!     npm owner ls oracle
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 14.0.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "oracle"
npm ERR! cwd /Users/alexanderkornhauser/Desktop
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0

I do however have the occi.h file. I have scoured online for hours to no avail. Any ideas?

AlexK
  • 336
  • 8
  • 21
  • 41
  • Have you followed the installation guide? https://github.com/joeferner/node-oracle#basic-installation – Kevin Simper Dec 03 '14 at 15:09
  • I followed it word for word – AlexK Dec 03 '14 at 15:36
  • 1
    when you type `$ printenv` and `$ sudo printenv` in the shell, does it show that `OCI_INCLUDE_DIR` and `OCI_LIB_DIR` is set and correct? – mattr Dec 03 '14 at 16:15
  • What should I look for? I get a lot of text... The only shell thing is: SHELL=/bin/bash – AlexK Dec 03 '14 at 16:18
  • First off, you shouldnt really need to use `sudo`. In fact, you may screw things up that way, because some files will get created with the wrong permissions (and you will get more errors). I suggest changing the ownership of the whole directory and stop using `sudo` after that (there is no need for it). To change the ownership of the current dir (recursively) run `sudo chown -R .` and sub in your system username. Secondly... – mattr Dec 03 '14 at 18:46
  • Secondly, the link https://github.com/joeferner/node-oracle#basic-installation indicates `* Set environment variables:`. The command `printenv` spits back your environment vars into the console. That allows you to debug your env vars. If you don’t see something like `OCI_LIB_DIR=/path/to/instant_client` and `OCI_INCLUDE_DIR=/path/to/instant_client/sdk/include` you probably didn’t set them correctly, therefore it can’t find the headers. If it is not set, you haven’t fulfilled the installation requirement `* Set environment variables:` – mattr Dec 03 '14 at 18:52
  • How do I set them correctly then? I literally did exactly what Joe Ferner's github said to do... I typed in from Desktop: 'OCI_LIB_DIR=instantclient' and 'OCI_INCLUDE_DIR=instantclient/sdk/include' where instantclient is the folder with the files – AlexK Dec 03 '14 at 19:19
  • This is not the best solution but try prefixing with `export`, for example: `export OCI_INCLUDE_DIR=/path/to/instant_client/sdk/include`. Note you will have to set the vars every time with this approach. I would suggest brushing up on the basics of `bash environment variables`. Also, here is a question on `export` that explains some important fundamentals: http://stackoverflow.com/a/7328289/798682. I really cant go into a full tutorial here so I'm giving you some terms that you can google on your own. For example, look into `.bash_profile` for persisting your environment variables. – mattr Dec 03 '14 at 19:38

2 Answers2

2

I posted a bounty since I hit this issue but then I was able to resolve it in a few steps. You need to export the variables, then do a few more items. I found detailed install instructions for the oracle driver here - https://github.com/joeferner/node-oracle/blob/master/INSTALL.md

Just follow those step by step and you should be good.

HelloWorld
  • 4,251
  • 8
  • 36
  • 60
0

I hit the same error and I saw that I forgot to install Instant Client Package - SDK which has additional header files and an example makefile for developing Oracle applications with Instant Client. When I put the sdk folder to the $OCI_HOME (that is the path to the instantclient_VV_v folder) , it was resolved.

mcvkr
  • 3,209
  • 6
  • 38
  • 63