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

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