摘要:本篇教程介绍了Node.js教程 node-oracle windows下编译安装详解,希望阅读本篇文章以后大家有所收获,帮助大家对Node.js的理解更加深入。
本篇教程介绍了Node.js教程 node-oracle windows下编译安装详解,希望阅读本篇文章以后大家有所收获,帮助大家对Node.js的理解更加深入。
<
步骤
1安装 oracle 11g
oracle官网下载orcale 11g ,【现在还是别用10g了,反正我没有用】
2 安装 microsoft visual studio2012 express
使用microsoft visual studio2013安装没有成功,不过应该2013也可以。以后再试。
3 安装nodejs
最新版最好,npm在1.3.15版本以前node-gyp 在编译时会调用VCBuild.exe,在vs2012下是找不到的VCBuild.exe的。
4 安装 oracle instant client
下载 Version 12.1.0.1.0 中的 instantclient-basic-windows.x64-12.1.0.1.0.zip和instantclient-sdk- windows.x64-12.1.0.1.0.zip; 并把它们解压到 C:\instantclient_12_1 文件夹中, 由于两个 zip 中的文件各不相同, 所以合并到同一个文件夹也不会发生覆盖。
5 设置环境变量
OCI_INCLUDE_DIR=C:\instantclient_12_1\sdk\include
OCI_LIB_DIR=C:\instantclient_12_1\sdk\lib\msvc\vc11
OCI_VERSION=12
Path=...;c:\instantclient_12_1\vc11;c:\instantclient_12_1
确保 Path 中 c:\instantclient_12_1\vc11 在 c:\instantclient_12_1 前面,最好放在最前面,安装了oracle后,如果放到后面可能会调用oracle安装目录下的文件,放在后面时,有时候编译失败。
6 安装 python2.7
安装python2.7 ,3.x版本不行,node-gyp不支3.x·, 环境变量path里添加 C:\Python27,如果安装了3.x版本的要从环境变量里移除!
7 安装 node-gyp
cmd命令窗口里:
npm install -g node-gyp
8 安装 node-oracle
cmd:
npm install -g oracle
建议全局安装,因为在不同的机器上需要编译不同的版本,省得再在协同开发时,导致不同人员的冲突,尤其是使用GIT时候。
错误处理
1 MSBUILD : error MSB3411: Could not load the Visual C++ component “VCBuild.exe”.
报错内容:
MSBUILD : error MSB3411: Could not load the Visual C++ component "VCBuild.exe".
If the component is not installed, either 1) install the Microsoft Windows SDK
for Windows Server 2008 and .NET Framework 3.5, or 2) install Microsoft Visual
Studio 2008. [C:\Users\Administrator\AppData\Roaming\npm\node_modules\oraclebuild\binding.sln]
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` 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:267:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Administrator\AppData\Roaming\npm\node_modules\oracle
gyp ERR! node -v v0.10.21
gyp ERR! node-gyp -v v0.10.10
gyp ERR! not ok
npm ERR! weird error 1
npm ERR! not ok code 0
原因
npm在1.3.15版本以前node-gyp 在编译时会调用VCBuild.exe,在vs2012下是找不到的VCBuild.exe,vs2012及以后版本是msbuild.exe作为编译器。
解决:
将npm 的 msvs的编译器设置为vs2012 cmd执行:
npm config set msvs_version 2012 --global
本文由职坐标整理并发布,希望对同学们有所帮助。了解更多详情请关注WEB前端Node.js频道!
您输入的评论内容中包含违禁敏感词
我知道了
请输入正确的手机号码
请输入正确的验证码
您今天的短信下发次数太多了,明天再试试吧!
我们会在第一时间安排职业规划师联系您!
您也可以联系我们的职业规划师咨询:
版权所有 职坐标-一站式IT培训就业服务领导者 沪ICP备13042190号-4
上海海同信息科技有限公司 Copyright ©2015 www.zhizuobiao.com,All Rights Reserved.
沪公网安备 31011502005948号