LoginSignup
1
1

More than 5 years have passed since last update.

RaspberryPi2のCannot find module 'rpi-gpio'を解決した

Last updated at Posted at 2017-02-23

目的:

RaspberryPi2とAE-BME280を利用し、
mBaaSのKiiに温度湿度気圧情報を格納する。

現象:

参考URL
https://docs.kii.com/ja/guides/external_services/mythings/device_preparation/raspberrypi_setup/
において

サンプルコード
https://github.com/KiiPlatform/thing-if-node-sample

test-gpio.js
実行時に
Error: Cannot find module 'rpi-gpio'
が発生する。

処置:

npm install rpi-gpio

でインストールを試すが、エラー出力

./npm-debug.log
を確認し、
epoll@0.1.21のインストールが必要であると確認

参考URL
https://github.com/fivdi/epoll/issues/14

より

sudo npm install -f --unsafe-perm node-gyp
sudo node-gyp rebuild
sudo npm install rpi-gpio --save

により正常にrpi-gpioのインストールが完了

sudo node test-gpio.js

が正常に動作した。

環境:

Hard:Raspberry Pi2 Model B
OS:RASPBIAN JESSIE WITH PIXEL
Release date:2017-01-11
Kernel version:4.4

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1