本人用的是nw0.14.7 LTS版 nw封裝的node版本:5.12.0
安裝好最新nodejs環境 我用的是node 12.x.x
1.裝好Python2.7 並且設置系統 環境變量 [很重要] 要實現 能在cmd上運行 python 命令 那種
2.安裝npm 構建器
npm install node-pre-gyp -g
3.安裝node-webkit 構建器
npm install nw-gyp -g
4.安裝vs編譯器最新版本 [很重要] 無論成功失敗 切記要等3小時 因爲有時提示安裝失敗 後臺安裝軟件還在安裝幾個G
npm install --global --production windows-build-tools
5.編譯插件 例如sqlite3
npm install sqlite3 --build-from-source --runtime=node-webkit --target_arch=ia32 --target=5.12.0
npm有毒 : 版本號--target=有時候填NWjs的版本號5.12.0 有時填nw封裝的nodejs的版本號0.14.7
切記切記
一般都可以成功 部分插件實在奇葩 只能 換辦法去解決了
--------------------------------以下是踩坑筆記 可以不去看-----------強烈建議別去看下面的--------------------------------------
https://www.cnblogs.com/donaldtdz/p/10068351.html
上面那篇講的很詳細
安裝vc++編譯器
https://visualstudio.microsoft.com/zh-hans/visual-cpp-build-tools/
Install Visual C++ Build Toolset or Visual Studio
就是說 要安裝個10g左右的工具包 或者Visual Studio 全家桶
我個人選Visual C++ Build Toolset 在單個組件那裏勾選
-------------------------------------------------------------
裝好Python2.7
並且設置系統 環境變量 [很重要]
nw-gyp rebuild --target=5.12.0 --arch=ia32
node-pre-gyp build --runtime=node-webkit --target=5.12.0 --target_arch=ia32
------------------------------
npm install sqlite3 --build-from-source --runtime=node-webkit --target_arch=ia32 --target=5.12.0
npm install sqlite3 --build-from-source --runtime=node-webkit --target_arch=ia32 --target=5.12.0
npm有毒 : 版本號--target=有時候填NWjs的版本號 有時填nodejs的版本號
切記切記
--------------------------------------------------------------
安裝npm 構建器
npm install node-pre-gyp -g
安裝node-webkit 構建器
npm install nw-gyp -g
安裝vs2015
npm install --global --production [email protected]
安裝vs最新版本
npm install --global --production windows-build-tools
下載安裝插件
npm install sqlite3
切換到插件所在的目錄,
cd .\node_modules\sqlite3
生成nwjs的插件
npm install --build-from-source --runtime=node-webkit --target_arch=ia32 --target=5.12.0
或者
node-pre-gyp install --build-from-source --runtime=node-webkit --target_arch=ia32 --target=
成功後,會在sqlite3\lib\binding目錄下生成文件夾node-webkit-v0.12.3-win32-x64。這樣就安裝成功了
32位=ia32
64位=x64