【发布时间】:2016-11-04 11:04:07
【问题描述】:
我正在尝试在节点 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“基本”和“SDK”包,如果 您的数据库是远程的。或者使用来自 本地安装的数据库,例如免费的 Oracle XE
如果在安装过程中释放设置 OCI_LIB_DIR 和 OCI_INC_DIR Oracle 库和标头位于非默认位置运行 npm
安装 oracledb 以从 NPM regis 安装
试试。
【问题讨论】: