來來回回弄了兩個星期,今天終於成功了。我想這種就是成功后的喜悅。。。為了避免下次花沒必要的時間決定記錄下來。
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
下載地址是淘寶的,原因大家都懂。