Install node-oracledb on Windows

Oracle has a document for installing node-oracledb on Windows: https://community.oracle.com/docs/DOC-931127

Step-by-step guide 

Notes: make sure all Windows related tools installed with Win64 bits version!!!  

  1. Install prerequisites:
    1. Visual Studio 2015 Community Edition: https://www.visualstudio.com/downloads
      1. You might need to create a C++ project to install required Common Tools and Windows 8.1 SDK (http://stackoverflow.com/questions/33716369/error-trk0005-failed-to-locate-cl-exe/33716573)
    2. Python 2.7: https://www.python.org/downloads/release/python-2710/
    3. Node.js: https://nodejs.org/en/download/
      1. If the windows installer fails, you can download & unzip the binary version and set the environment variable pointing to this folder 
    4. Oracle instant client for Windows (including Instant Client Package - Basic and Instant Client Package - SDK): http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html
      1. Copy the contents in both zip files into C:\Oracle\instantclient
  2. Set System environment variables:
    1. PATH: C:\Oracle\instantclient
    2. OCI_LIB_DIR: C:\Oracle\instantclient\sdk\lib\msvc
    3. OCI_INC_DIR: C:\Oracle\instantclient\sdk\include
  3. Set Microsoft Visual Studio environment variables using vcvars64.bat (location in my computer is C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64)
  4. Run npm install --save oracledb
  5. Test connection using the example provided on the node-oracledb website
    1. Parameter connectString: https://github.com/oracle/node-oracledb/blob/master/doc/api.md#connectionstrings

Troubleshooting

Error: %1 is not a valid win32 application

This issue is caused by mixed use of 64bits and 32bits. Need to

  • check if all the dependencies are in 64bits version
  • uninstall all 32bits version MS Visual Studio as needed
  • check the above Step 3