nwjs Node-webkit nw安装编译插件

本人用的是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

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章