2016-05-31 88 views
-1

我試圖運行一個包含與Oracle數據庫連接的NodeJS(v0.10.36)文件。無法使用NodeJS連接到Oracle

當我嘗試運行該項目時,出現以下錯誤。

M1318657:testOracle yogeshJC$ node app.js 

module.js:340 
throw err; 
^ 
Error: Cannot find module '../build/Release/oracle_bindings' 
at Function.Module._resolveFilename (module.js:338:15) 
at Function.Module._load (module.js:280:25) 
at Module.require (module.js:364:17) 
at require (module.js:380:17) 
at Object.<anonymous> (/Users/yogeshJC/testOracle/node_modules/oracle/lib/oracle.js:2:16) 
at Module._compile (module.js:456:26) 
at Object.Module._extensions..js (module.js:474:10) 
at Module.load (module.js:356:32) 
at Function.Module._load (module.js:312:12) 
at Module.require (module.js:364:17) 

app.js包含連接到Oracle數據庫的簡單腳本。

我在這裏按照說明安裝oracledb

Oracle版本:11.2

以下環境中已設置:

OCI_HOME 
OCI_INC_DIR 
OCI_VERSION 
OCI_LIB_DIR 

任何解決這個問題線索,將不勝感激。

編輯:

須藤NPM安裝OracleDB的

M1318657:testOracle yogeshJC$ sudo npm install oracledb 
Password: 
npm WARN package.json [email protected] No repository field. 
npm WARN package.json [email protected] No repository field. 
| 
> [email protected] install /Users/yogeshJC/testOracle/node_modules/oracledb 
> node-gyp rebuild 

    CXX(target) Release/obj.target/oracledb/src/njs/src/njsOracle.o 
    CXX(target) Release/obj.target/oracledb/src/njs/src/njsPool.o 
    CXX(target) Release/obj.target/oracledb/src/njs/src/njsConnection.o 
    CXX(target) Release/obj.target/oracledb/src/njs/src/njsResultSet.o 
    CXX(target) Release/obj.target/oracledb/src/njs/src/njsMessages.o 
    CXX(target) Release/obj.target/oracledb/src/njs/src/njsIntLob.o 
../src/njs/src/njsIntLob.cpp:1222:3: warning: cannot refer to a non-static member from the handler of a constructor function try block [-Wexceptions] 
    cleanup(); 
^
1 warning generated. 
    CXX(target) Release/obj.target/oracledb/src/dpi/src/dpiEnv.o 
    CXX(target) Release/obj.target/oracledb/src/dpi/src/dpiEnvImpl.o 
../src/dpi/src/dpiEnvImpl.cpp:114:3: warning: cannot refer to a non-static member from the handler of a constructor function try block [-Wexceptions] 
    cleanup(); 
^
1 warning generated. 
    CXX(target) Release/obj.target/oracledb/src/dpi/src/dpiException.o 
    CXX(target) Release/obj.target/oracledb/src/dpi/src/dpiExceptionImpl.o 
    CXX(target) Release/obj.target/oracledb/src/dpi/src/dpiConnImpl.o 
../src/dpi/src/dpiConnImpl.cpp:100:3: warning: cannot refer to a non-static member from the handler of a constructor function try block [-Wexceptions] 
    cleanup(); 
^
../src/dpi/src/dpiConnImpl.cpp:139:3: warning: cannot refer to a non-static member from the handler of a constructor function try block [-Wexceptions] 
    cleanup(); 
^
2 warnings generated. 
    CXX(target) Release/obj.target/oracledb/src/dpi/src/dpiDateTimeArrayImpl.o 
    CXX(target) Release/obj.target/oracledb/src/dpi/src/dpiPoolImpl.o 
../src/dpi/src/dpiPoolImpl.cpp:145:3: warning: cannot refer to a non-static member from the handler of a constructor function try block [-Wexceptions] 
    cleanup(); 
^
1 warning generated. 
    CXX(target) Release/obj.target/oracledb/src/dpi/src/dpiStmtImpl.o 
../src/dpi/src/dpiStmtImpl.cpp:121:3: warning: cannot refer to a non-static member from the handler of a constructor function try block [-Wexceptions] 
    cleanup(); 
^
1 warning generated. 
    CXX(target) Release/obj.target/oracledb/src/dpi/src/dpiUtils.o 
    CXX(target) Release/obj.target/oracledb/src/dpi/src/dpiLob.o 
    CXX(target) Release/obj.target/oracledb/src/dpi/src/dpiCommon.o 
    SOLINK_MODULE(target) Release/oracledb.node 
    SOLINK_MODULE(target) Release/oracledb.node: Finished 
[email protected] node_modules/oracledb 
└── [email protected] 
+0

請粘貼此輸出:'npm install oracledb' – Aminadav

+0

帶輸出的更新問題。 –

回答

0

你有一些衝突。您粘貼的錯誤指的是node_modules/oracle,這是Oracle DB的舊版不支持的模塊,並不是您顯示安裝的​​模塊。

建議: