Windows下Electron引入robotjs遇到的问题
问题一:Error: Cannot find module './build/Release/robotis.node
是因为没编译robotjs,编译方法:
管理员权限运行powershell
cnpm install -g --production windows-build-tools
cnpm install -g node-gyp
重新编译robotjs:
在项目的node_modules\robotjs
下执行:
// 安装依赖
cnpm install
// 编译
node-gyp rebuild
问题二:编译成功后仍然遇到版本不匹配的问题:
其实报错信息中已经提示了 需要哪个版本
重新编译对应版本的robotjs就行了
–target: electron的版本
–abi: electron中Node对应的abi 地址:github.com/mapbox/node…
node-gyp rebuild --runtime=electron --target=10.0.0 --disturl=https://atom.io/download/atom-shell --abi=93