I have installed Oracle local Database 11.2.0.I have set the environment variables for OCI_LIB and OCI_Include and I have also set the path for Oracle home directory.I have also installed python 2.7.I have also installed C++ compiler and also installed Visual Studio C++ redistributable using Windows-build-tools.But still error is coming in npm install oracledb.
"Cannot open include file oci.h"
The logs are:
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
njsOracle.cpp
njsPool.cpp
njsConnection.cpp
njsResultSet.cpp
D:\New folder\server\ServerDashboard\node_modules\oracledb\src\dpi\include\dpiLob.h(34): fatal error C1083: Cannot open include file: 'oci.h': No such file or directory (compiling source file ..\src\njs\src\njsResultSet.cpp) [D:\New folder\server\ServerDashboard\node_modules\oracledb\build\oracledb.vcxproj]
D:\New folder\server\ServerDashboard\node_modules\oracledb\src\dpi\include\dpiLob.h(34): fatal error C1083: Cannot open include file: 'oci.h': No such file or directory (compiling source file ..\src\njs\src\njsConnection.cpp) [D:\New folder\server\ServerDashboard\node_modules\oracledb\build\oracledb.vcxproj]
njsMessages.cpp
njsIntLob.cpp
dpiEnv.cpp
D:\New folder\server\ServerDashboard\node_modules\oracledb\src\dpi\src\dpiEnvImpl.h(30): fatal error C1083: Cannot open include file: 'oci.h': No such file or directory (compiling source file ..\src\dpi\src\dpiEnv.cpp) [D:\New folder\server\ServerDashboard\node_modules\oracledb\build\oracledb.vcxproj]
dpiEnvImpl.cpp
D:\New folder\server\ServerDashboard\node_modules\oracledb\src\dpi\include\dpiLob.h(34): fatal error C1083: Cannot open include file: 'oci.h': No such file or directory (compiling source file ..\src\njs\src\njsIntLob.cpp) [D:\New folder\server\ServerDashboard\node_modules\oracledb\build\oracledb.vcxproj]
dpiException.cpp
D:\New folder\server\ServerDashboard\node_modules\oracledb\src\dpi\include\dpiLob.h(34): fatal error C1083: Cannot open include file: 'oci.h': No such file or directory (compiling source file ..\src\njs\src\njsPool.cpp) [D:\New folder\server\ServerDashboard\node_modules\oracledb\build\oracledb.vcxproj]
dpiExceptionImpl.cpp
D:\New folder\server\ServerDashboard\node_modules\oracledb\src\dpi\src\dpiEnvImpl.h(30): fatal error C1083: Cannot open include file: 'oci.h': No such file or directory (compiling source file ..\src\dpi\src\dpiEnvImpl.cpp) [D:\New folder\server\ServerDashboard\node_modules\oracledb\build\oracledb.vcxproj]
dpiConnImpl.cpp
D:\New folder\server\ServerDashboard\node_modules\oracledb\src\dpi\src\dpiConnImpl.h(30): fatal error C1083: Cannot open include file: 'oci.h': No such file or directory (compiling source file ..\src\dpi\src\dpiConnImpl.cpp) [D:\New folder\server\ServerDashboard\node_modules\oracledb\build\oracledb.vcxproj]
dpiDateTimeArrayImpl.cpp
dpiPoolImpl.cpp
D:\New folder\server\ServerDashboard\node_modules\oracledb\src\dpi\src\dpiUtils.h(30): fatal error C1083: Cannot open include file: 'oci.h': No such file or directory (compiling source file ..\src\dpi\src\dpiDateTimeArrayImpl.cpp) [D:\New folder\server\ServerDashboard\node_modules\oracledb\build\oracledb.vcxproj]
dpiStmtImpl.cpp
D:\New folder\server\ServerDashboard\node_modules\oracledb\src\dpi\include\dpiLob.h(34): fatal error C1083: Cannot open include file: 'oci.h': No such file or directory (compiling source file ..\src\njs\src\njsOracle.cpp) [D:\New folder\server\ServerDashboard\node_modules\oracledb\build\oracledb.vcxproj]
D:\New folder\server\ServerDashboard\node_modules\oracledb\src\dpi\src\dpiEnvImpl.h(30): fatal error C1083: Cannot open include file: 'oci.h': No such file or directory (compiling source file ..\src\dpi\src\dpiPoolImpl.cpp) [D:\New folder\server\ServerDashboard\node_modules\oracledb\build\oracledb.vcxproj]
dpiUtils.cpp
dpiLob.cpp
D:\New folder\server\ServerDashboard\node_modules\oracledb\src\dpi\include\dpiStmt.h(30): fatal error C1083: Cannot open include file: 'oci.h': No such file or directory (compiling source file ..\src\dpi\src\dpiStmtImpl.cpp) [D:\New folder\server\ServerDashboard\node_modules\oracledb\build\oracledb.vcxproj]
dpiCommon.cpp
D:\New folder\server\ServerDashboard\node_modules\oracledb\src\dpi\include\dpiLob.h(34): fatal error C1083: Cannot open include file: 'oci.h': No such file or directory (compiling source file ..\src\dpi\src\dpiLob.cpp) [D:\New folder\server\ServerDashboard\node_modules\oracledb\build\oracledb.vcxproj]
win_delay_load_hook.cc
..\src\dpi\src\dpiCommon.cpp(28): fatal error C1083: Cannot open include file: 'oci.h': No such file or directory [D:\New folder\server\ServerDashboard\node_modules\oracledb\build\oracledb.vcxproj]
D:\New folder\server\ServerDashboard\node_modules\oracledb\src\dpi\src\dpiUtils.h(30): fatal error C1083: Cannot open include file: 'oci.h': No such file or directory (compiling source file ..\src\dpi\src\dpiUtils.cpp) [D:\New folder\server\ServerDashboard\node_modules\oracledb\build\oracledb.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\lakshaybansal\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\lakshaybansal\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd D:\New folder\server\ServerDashboard\node_modules\oracledb
gyp ERR! node -v v6.9.1
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN [email protected] No repository field.
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Users\lakshaybansal\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "oracledb" "--save"
npm ERR! node v6.9.1
npm ERR! npm v4.0.3
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, 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 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! D:\New folder\server\ServerDashboard\npm-debug.log
You need to set OCI_INC_DIR & OCI_LIB_DIR, can you please echo %OCI_xxx_DIR% and update with output. Thanks
I have set both of them and attached the output snapshot
Hi pvenkatRaman,
Any Solution?
Cannot open include file: 'oci.h': means either the file doesn't exist, or the OCI_INC_DIR env var is not set in the place where the compiler needs it to be set. Or the compiler can't access the directory.
Try some more debugging and experimentation.
Faced similar issue and it got resolved through below installation steps:
Open an elevated CMD prompt (run as Administrator).
navigate to your app folder
npm install --global npm
npm install --global --production windows-build-tools
npm install instantclient
set PATH=%cd%\instantclient;%PATH%
set OCI_LIB_DIR=%cd%\instantclient\sdk\lib\msvc
set OCI_INC_DIR=%cd%\instantclient\sdk\include
npm install oracledb
Referecnced from :https://github.com/oracle/node-oracledb/issues/483
@devrishal thanks for sharing that tip.
Closed due to lack of feedback from @lakshaybansal
@devrishal worked for me as well, ty
This is still an issue and devrishals fix does not work for me.
@cblanto7 review the instructions https://oracle.github.io/node-oracledb/INSTALL.html
node-oracledb 2 doesn't include oci.h so you might be badly out of date.
If you still have a problem, open a new issue. This current one was closed a year ago.
Most helpful comment
Faced similar issue and it got resolved through below installation steps:
Open an elevated CMD prompt (run as Administrator).
navigate to your app folder
npm install --global npm
npm install --global --production windows-build-tools
npm install instantclient
set PATH=%cd%\instantclient;%PATH%
set OCI_LIB_DIR=%cd%\instantclient\sdk\lib\msvc
set OCI_INC_DIR=%cd%\instantclient\sdk\include
npm install oracledb
Referecnced from :https://github.com/oracle/node-oracledb/issues/483