繁体   English   中英

npm 安装节点 oracledb 失败

[英]npm install node-oracledb fails

我想通过节点 js 连接 oracle 数据库。 为此,我尝试安装 node-oracledb 模块。

$ npm 安装 oracle/node-oracledb#v3.1.2

这会抛出以下错误消息。

oracledb@3.1.2 安装 C:\Users\Desktop\WebApp\node-oracle-db\node_modules\oracledb node-gyp rebuild

C:\Users\Desktop\WebApp\node-oracle-db\node_modules\oracledb>如果没有定义npm_config_node_gyp(节点“C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\ ....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js “重建)gyp ERR:配置错误gyp ERR,堆栈错误。 找不到 Python 可执行文件“python”。 您可以设置 PYTHON 环境变量:gyp ERR。 堆栈在 PythonFinder:failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483.19) gyp ERR: 堆栈在 PythonFinder: (C:\ npm\node_modules\node-gyp\lib\configure.js:508:16) gyp 错误。 堆栈在 C.\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills:js:284.29 gyp ERR。 堆栈在 FSReqWrap:oncomplete (fs.js:166.21) gyp ERR: System Windows_NT 10.0.14393 gyp ERR。 命令“C.\Program Files\nodejs\node.exe”“C.\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js”“重建”gyp ERR。 cwd C.\Users\Desktop\WebApp\node-oracle-db\node_modules\oracledb gyp 错误! 节点 -v v9.5.0 gyp 错误! node-gyp -v v3.6.2 gyp 错误! 不行 npm WARN oracle-db@1.0.0 没有描述 npm WARN oracle-db@1.0.0 没有存储库字段。

npm 错误。 代码 ELIFECYCLE npm ERR。 errno 1 npm ERR:oracledb@3.1.2 安装: node-gyp rebuild npm ERR。 退出状态 1 npm ERR。 npm 错误。 oracledb@3.1.2 安装脚本失败。 错误! 这可能不是 npm 的问题。 上面可能有额外的日志输出。

npm ERR:可以在以下位置找到此运行的完整日志:npm ERR!
C:\Users\AppData\Roaming\npm-cache_logs\2019-04-09T06_36_44_005Z-debug.log

我不明白为什么我需要依赖 python 才能连接 oracle db? 以及如何做?

通过节点 js 连接 oracle 数据库,运行

npm 安装 oracledb

节点是使用 GYP 构建的,它使用 python。 我认为这就是您收到此错误的原因。 尽管要运行 Nodejs 应用程序,您根本不需要 python。 也许这将是这个特定包的要求。 您正在指定需要安装 python 的节点 oracle-db 版本。

您可以运行以下命令来解决您的问题

npm install oracledb

这不应该给你你所面临的错误。

如果这不起作用,您可以按照以下操作

您可以运行以下命令来解决您遇到的问题。

npm install --global --production windows-build-tools

这将在您的系统上安装 python。

然后就可以全局安装gyp了

npm install node-gyp

那么也许你可以安装你正在寻找的特定版本 node-oracledb

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM