Nodejs oracledb包:错误:'gyp'失败,退出代码:1

时间:2017-04-12 14:49:28

标签: node.js oracle npm oracledb

我在Windows 7上安装oracledb时遇到了大量问题。我收到以下错误:

> oracledb@1.13.1 install C:\Users\alex.cauthen\Documents\CLA\cla_ui\node_module
s\oracledb
> node-gyp rebuild


C:\Users\alex.cauthen\Documents\CLA\cla_ui\node_modules\oracledb>if not defined
npm_config_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 "" rebu
ild )
Traceback (most recent call last):
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\gyp_m
ain.py", line 16, in <module>
    sys.exit(gyp.script_main())
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib
\gyp\__init__.py", line 545, in script_main
    return main(sys.argv[1:])
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib
\gyp\__init__.py", line 538, in main
    return gyp_main(args)
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib
\gyp\__init__.py", line 514, in gyp_main
    options.duplicate_basename_check)
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib
\gyp\__init__.py", line 98, in Load
    generator.CalculateVariables(default_variables, params)
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib
\gyp\generator\msvs.py", line 1900, in CalculateVariables
    generator_flags.get('msvs_version', 'auto'))
  File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib
\gyp\MSVSVersion.py", line 434, in SelectVisualStudioVersion
    versions = _DetectVisualStudioVersions(version_map[version], 'e' in version)

KeyError: '2017'
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (C:\Program Files\nodejs\node_module
s\npm\node_modules\node-gyp\lib\configure.js:305:16)
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:215:12)
gyp ERR! System Windows_NT 6.1.7601
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\alex.cauthen\Documents\CLA\cla_ui\node_modules\oracledb
gyp ERR! node -v v6.10.2
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
cla_ui@1.0.0 C:\Users\alex.cauthen\Documents\CLA\cla_ui
`-- (empty)

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\ch
okidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@
1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}
)
npm WARN cla_ui@1.0.0 No description
npm WARN cla_ui@1.0.0 No repository field.
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "install" "oracledb"
npm ERR! node v6.10.2
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE

为了安装oracledb,我遵循了本演练:https://community.oracle.com/docs/DOC-931127。这就是我所做的:

  • 我安装了visual studio 2012
  • 我安装了python 2.7
  • 我有节点6.10.2和npm 3.10.10
  • 我安装了oracle即时客户端basic和sdk,将它们解压缩到C:\ oracle \ instantclient中的instantclient文件夹
  • 路径环境variable = C:\ Program Files \ nodejs \; C:\ Python27 \; C:\ oracle \ instantclient;
  • 创建环境变量OCI_LIB_DIR = C:\ oracle \ instantclient \ sdk \ lib \ msvc
  • 创建环境变量OCI_INC_DIR = C:\ oracle \ instantclient \ sdk \ include

然后我安装的最后一件事就是做npm install oracledb。我不知道该怎么办。我浪费了很多时间调试/试图安装它。如果你看到我错过了什么,请告诉我...并感谢你的帮助。

亚历

0 个答案:

没有答案