electron 編譯原生包的一波三折(串口)


來來回回弄了兩個星期,今天終於成功了。我想這種就是成功后的喜悅。。。為了避免下次花沒必要的時間決定記錄下來。

 

Python 2.XX安裝好,版本必須是2,3會報錯

第一步全局安裝node-gyp

npm install node-gyp -g

第二步由於windows下所以需要安裝windows-build-tools或者VS

npm install --global --production windows-build-tools

 

第三步安裝electron

npm install electron -s

第四步 安裝serialport

npm install serialport -s

這里說下,安裝串口包時會默認編譯,這里的編譯和electron 編譯是不想干的,(根據本都node的版本編譯)

第四步 將serialpot編譯成electron能用的包

   cd node_modules/@serialport/bindings
node-gyp rebuild --target=5.0.8 --arch=x64 --target_arch=x64 --dist-url=https://npm.taobao.org/mirrors/atom-shell --msvs_version=2017

這里編譯地址是node_modules/@serialport/bindings不是node_modules/serialport

下載地址是淘寶的,原因大家都懂。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM