安装node-oracledb

时间:2016-08-19 11:14:41

标签: node.js node-oracle

我有一个简单的node.js服务器和一些运行它的应用程序,应该连接到Oracle数据库。出于这个原因,我决定使用node-oracledb驱动程序,但我在安装时遇到了一些问题。我按照Oracle webpage上的说明和github上的说明操作,但我仍然会收到以下错误。

我的环境配置:

  • Windows 8.1 Pro 64位
  • node.js v6.4.0
  • npm v3.10.3
  • MS Visual Studio 2013社区版
  • Python v2.7.12
  • Oracle Instant Client(基本+ SDK)v12.1.0.2.0

节点,Python和Oracle Instant Client文件夹包含在PATH变量中。 OCI_LIB_DIR和OCI_INC_DIR也根据github指令设置。

问题在于:当我执行命令npm install oracledb -g时,会发生以下错误:

> oracledb@1.11.0 install C:\Users\pr\AppData\Roaming\npm\node_modules\ora
cledb
> node-gyp rebuild


C:\Users\pr\AppData\Roaming\npm\node_modules\oracledb>if not defined npm_c
onfig_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\
\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )

Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
C:\Users\pr\AppData\Roaming\npm\node_modules\oracledb\build\oracledb.vcxp
roj(20,3): error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props"
 was not found. Confirm that the path in the <Import> declaration is correct, a
nd that the file exists on disk.
gyp ERR! build error
gyp ERR! stack Error: `msbuild` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\
npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_proces
s.js:204:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodej
s\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\pr\AppData\Roaming\npm\node_modules\oracledb
gyp ERR! node -v v6.4.0
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "install" "oracledb" "-g"
npm ERR! node v6.4.0
npm ERR! npm  v3.10.3
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!     C:\Users\pr\Development\Visual Studio 2013\npm-debug.log

我真的不知道在哪里寻找解决方案。什么可能导致错误? node / oracle client / python之间是否存在任何已知的不兼容性?

还有一件事:github指示说:

  

确保已设置Microsoft Visual Studio环境变量   适当。使用set PATH并验证它是否包含Visual Studio   路径。如果未设置,请使用vcvars64.bat(如果您使用vcvars.bat)   使用32位二进制文​​件构建)来设置环境。

应该设置哪些VS环境变量以及哪些VS路径应该完全包含在PATH中?

2 个答案:

答案 0 :(得分:1)

像oracledb或node-oracledb这样的模块需要编译。编译需要像C编译器,Python等软件。

我遇到了与oracldb模块相同的问题。按照以下说明操作,它就像魅力一样。

https://community.oracle.com/docs/DOC-931127

答案 1 :(得分:0)

尝试将npm更新为最新版本:

npm install -g npm

如果它仍然不起作用,请尝试包括你的VS版本:

npm install oracledb --msvs_version=2013
相关问题