如何在electron App中使用raspberry pi的GPIO?

How to use GPIO of raspberry pi in electron App?

我正在尝试使用 electronJs 为 raspberry pi 3 (b) 构建一个应用程序。我无法使用 nodejs 的“onoff”模块与 raspberry pi 的 GPIO 进行通信。当我在主进程中导入它并尝试使用 electron . 命令 运行 应用程序时,该命令退出且没有错误信息。谁能建议如何在电子应用程序中使用 raspberry pi3 的 GPIO。

此外,如果 electronJs 无法实现,那么请建议我如何为 raspberry pi 实现一个可以使用 GPIO 的 GUI 应用程序。

相同 https://github.com/AkshayKanchan/electron_gpio

的示例回购

正在将 nodeJS 更新到最新版本和 运行 electron-rebuild solved my problem. Thank you Dave Newton for your help. Seems like there was an issue with epoll compilation which is used by onoff 包。