electron 使用dll

//创建项目 
npm install --save-dev electron --registry=https://registry.npm.taobao.org
//安装插件
npm install ffi ref  --save

要是报这个错
在这里插入图片描述

//注意安装这个需要装git
npm install ffi@gavignus/node-ffi#torycl/forceset-fix --save

//全局安装原生模块编译模块,编译ffi模块时需要用到的,这里一定要安装
npm install node-gyp -g
//安装c++编译构建依赖
npm install --global --production windows-build-tools 

 //偷懒一次全部编译可使用这个
npm install --save-dev electron-rebuild  
./node_modules/electron-rebuild  
//如果失败则需要分别进ref目录和ffi目录运行
 //32位则是-arch=ai84   --target=electron版本号
node-gyp rebuild --target=4.2.5 --arch=x64 --target_arch=x64 --dist-url=https://npm.taobao.org/mirrors/atom-shell 后再npm run dev 就成功了
/**
如果编译失败则查看package.json中是否有这两个配置
"license": "CC0-1.0",
 "private": true,
*/

如有不解,请加群 897149839

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