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"