在NodeJs中安装oracledb时出错

时间:2016-11-04 11:04:07

标签: node.js ssl npm node-gyp

我正在尝试在节点js中安装oracledb,但是当我运行命令

>npm install oracledb

在这些命令之后:

> oracledb@1.11.0 install D:\xyz\XYZApp\npm\node_modules\oracledb
> node-gyp rebuild

发生错误:

D:\xyz\XYZApp\npm\node_modules\oracledb>if not defined npm_config_node_gyp
 (node "C:\Users\abc\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-
bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebui
ld )
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: self signed certificate in certificate chain
gyp ERR! stack     at Error (native)
gyp ERR! stack     at TLSSocket.<anonymous> (_tls_wrap.js:1017:38)
gyp ERR! stack     at emitNone (events.js:67:13)
gyp ERR! stack     at TLSSocket.emit (events.js:166:7)
gyp ERR! stack     at TLSSocket._init.ssl.onclienthello.ssl.oncertcb.TLSSocket._
finishInit (_tls_wrap.js:582:8)
gyp ERR! stack     at TLSWrap.ssl.onclienthello.ssl.oncertcb.ssl.onnewsession.ss
l.onhandshakedone (_tls_wrap.js:424:38)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\abc\
\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp
.js" "rebuild"
gyp ERR! cwd D:\xyz\XYZApp\npm\node_modules\oracledb
gyp ERR! node -v v4.4.3
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok

npm WARN enoent ENOENT: no such file or directory, open 'D:\xyz\XYZApp\npm
\node_modules\instantclient_12_1\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\xyz\XYZApp\npm
\node_modules\node-v4.4.3\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\xyz\XYZApp\npm
\node_modules\sdk\package.json'
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\abc\\Ap
pData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "oracledb"
npm ERR! node v4.4.3
npm ERR! npm  v3.10.8
npm ERR! code ELIFECYCLE

npm ERR! oracledb@1.11.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the oracledb@1.11.0 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:\xyz\XYZApp\npm\npm-debug.log

我尝试过在互联网上提供的许多解决方案:

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

仍然遇到相同的错误,无法解决问题。任何人都可以帮助解决问题。

安装先决条件:

  • Python 2.7 C编译器,支持C ++ 11(Xcode,gcc,Visual 工作室或类似的)

    小型,免费的Oracle Instant Client&#34;基本&#34;和&#34; SDK&#34;包裹如果 你的数据库是远程的。或者使用来自的库和标题 本地安装的数据库,例如免费的Oracle XE

    在安装过程中释放设置OCI_LIB_DIR和OCI_INC_DIR Oracle库和标头位于非默认位置Run npm

    安装oracledb以从NPM regis安装

    试。

1 个答案:

答案 0 :(得分:0)

TLSSocket错误可能表示npm正在尝试访问网络(以安装所需的依赖项)但网络正在阻止它。您需要设置http_proxy或https_proxy环境变量吗?

此外,如果您对第三方二进制文件没问题,请查看https://github.com/oracle/node-oracledb/issues/18上预构建的Windows节点 - oracledb二进制文件

相关问题