本文共 861 字,大约阅读时间需要 2 分钟。
如何准备Electron
http://blog.csdn.net/chenhaifeng2016/article/details/74917361
如何开发一个NodeJS第三方模块
http://blog.csdn.net/chenhaifeng2016/article/details/74939493
NodeJS第三方模块要用于Electron需要重新编译。
修改第三方模块的配置文件package.json
{ "name": "facerecognitiondll", "version": "1.0.0", "description": "", "main": "main.js", "scripts": { "install": "node-gyp rebuild -target=1.6.11 -arch=x64 -dist-url=https://atom.io/download/atom-shell" }, "author": "", "license": "ISC", "gypfile": true}生成模块
npm install
创建文件main.js导出模块
const facerecognitiondll = require('./build/Release/facerecognitiondll');exports.CAMOpen = facerecognitiondll.CAMOpen;通过npm install facerecognitiondll安装此模块到本地nodes_modules目录。
修改index.html
人脸识别测试程序
运行npm start
项目结构
参考资料
https://github.com/electron/electron/blob/master/docs-translations/zh-CN/tutorial/using-native-node-modules.md