安装robotjs后,按照robotjs官网提示:
You can use this line to rebuild RobotJS for Electron:
npm rebuild --runtime=electron --target=1.1.3 --disturl=https://atom.io/download/atom-shell --abi=48
Target should be the Electron version, and abi should be the abi version of the included Node. You can check what version of Node is used in Electron by looking it up in the?releases?page or by using?process.version ?(see?Quick Start?for example). You can find the correct abi version?here.
You can include this line in the scripts section of your package.json to build RobotJS automatically.
"rebuild": "npm rebuild --runtime=electron --target=1.1.3 --disturl=https://atom.io/download/atom-shell --abi=48"
注意:找到electron的版本和对应该的node版本,这里的node版本可不是你在命令行中查到的版本;
步骤:
?先安装:electron-rebuild
yarn add electron-rebuild
./node_modules/.bin/electron-rebuild
进入robotjs目录
cd ./node_modules/robotjs
node-gyp rebuild --runtime=electron --target=17.1.0 --disturl=https://atom.io/download/atom-shell --abi=93
注意上面的target是你的electron版本,abi在这里找到对应用的[找ABI]
?======================== 结束 ========================
|