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!!!
- Install prerequisites:
- Visual Studio 2015 Community Edition: https://www.visualstudio.com/downloads
- 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)
- Python 2.7: https://www.python.org/downloads/release/python-2710/
- Node.js: https://nodejs.org/en/download/
- If the windows installer fails, you can download & unzip the binary version and set the environment variable pointing to this folder
- 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
- Copy the contents in both zip files into C:\Oracle\instantclient
- Visual Studio 2015 Community Edition: https://www.visualstudio.com/downloads
- Set System environment variables:
- PATH: C:\Oracle\instantclient
- OCI_LIB_DIR: C:\Oracle\instantclient\sdk\lib\msvc
- OCI_INC_DIR: C:\Oracle\instantclient\sdk\include
- 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)
- Run npm install --save oracledb
- Test connection using the example provided on the node-oracledb website
- 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