我已经设置了环境变量:
export ORACLE_HOME=/usr/lib/oracle/12.1/client64
export LD_LIBRARY_PATH=$ORACLE_HOME
export DYLD_LIBRARY_PATH=$ORACLE_HOME
我还在 ORACLE_HOME 中设置了一个软链接(soft link),因为包含在这里:
/usr/include/oracle/12.1/client64/
所以:
export OCI_INCLUDE_DIR=$ORACLE_HOME/include/
但是 npm install oracle 仍然失败 - 我确信这与我的 oracle 安装设置的配置方式有关,但不知道如何修复它。
这是我的错误:
npm WARN package.json banner_test@1.0.0 No description
npm WARN package.json banner_test@1.0.0 No repository field.
npm WARN package.json banner_test@1.0.0 No README data
\
> oracle@0.3.8 install /home/cdcoulon/Desktop/proto/banner_test/node_modules/oracle
> node-gyp rebuild
make: Entering directory `/home/cdcoulon/Desktop/proto/banner_test/node_modules/oracle/build'
CXX(target) Release/obj.target/oracle_bindings/src/connection.o
CXX(target) Release/obj.target/oracle_bindings/src/oracle_bindings.o
CXX(target) Release/obj.target/oracle_bindings/src/executeBaton.o
CXX(target) Release/obj.target/oracle_bindings/src/reader.o
CXX(target) Release/obj.target/oracle_bindings/src/statement.o
CXX(target) Release/obj.target/oracle_bindings/src/outParam.o
SOLINK_MODULE(target) Release/obj.target/oracle_bindings.node
/usr/bin/ld: cannot find -locci
/usr/bin/ld: cannot find -lclntsh
/usr/bin/ld: cannot find -lnnz12
collect2: error: ld returned 1 exit status
make: *** [Release/obj.target/oracle_bindings.node] Error 1
make: Leaving directory `/home/cdcoulon/Desktop/proto/banner_test/node_modules/oracle/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/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:820:12)
gyp ERR! System Linux 3.13.0-49-generic
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/cdcoulon/Desktop/proto/banner_test/node_modules/oracle
gyp ERR! node -v v0.10.38
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok
npm ERR! oracle@0.3.8 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the oracle@0.3.8 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 Linux 3.13.0-49-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "oracle"
npm ERR! cwd /home/cdcoulon/Desktop/proto/banner_test
npm ERR! node -v v0.10.38
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0
最佳答案
您正在使用 Joe Ferner 的“oracle”驱动程序。如果您需要的功能在较新的 node-oracledb 驱动程序中可用,您应该会发现安装更容易。您拥有即时客户端 RPM,因此无需为 node-oracledb 设置任何环境变量:只需使用“npm install oracledb”请参阅 https://github.com/oracle/node-oracledb/blob/master/INSTALL.md#instrpm
关于node.js - npm安装oracle失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30086581/