node-oracle windows下編譯安裝

來源:互聯網
上載者:User

標籤:io   os   使用   sp   java   for   檔案   on   ad   

步驟 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.zipinstantclient-sdk- windows.x64-12.1.0.1.0.zip; 並把它們解壓到 C:\instantclient_12_1 檔案夾中, 由於兩個 zip 中的檔案各不相同, 所以合并到同一個檔案夾也不會發生覆蓋。

5 設定環境變數
OCI_INCLUDE_DIR=C:\instantclient_12_1\sdk\includeOCI_LIB_DIR=C:\instantclient_12_1\sdk\lib\msvc\vc11OCI_VERSION=12Path=...;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 errorgyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1gyp 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.7601gyp 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\oraclegyp ERR! node -v v0.10.21gyp ERR! node-gyp -v v0.10.10gyp ERR! not oknpm ERR! weird error 1npm 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

node-oracle windows下編譯安裝

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.