# I2C-bus install fail - RPI Zero W

**URL:** <https://discourse.nodered.org/t/i2c-bus-install-fail-rpi-zero-w/45713>\
**Category:** General\
**Created:** [16 May 2021 09:45 UTC](https://discourse.nodered.org/t/i2c-bus-install-fail-rpi-zero-w/45713 "2021-05-16T09:45:46Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zodiac-69](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zodiac-69/32/29022_2.png) [@Zodiac-69](https://discourse.nodered.org/u/Zodiac-69)\
**Post date:** [16 May 2021 09:45 UTC](https://discourse.nodered.org/t/i2c-bus-install-fail-rpi-zero-w/45713/1 "2021-05-16T09:45:46Z")

</div>

I have a RPI Zero W with Node-RED.  
I am trying to install i2c-oled and it failed. I then tried other nodes and any node that use i2c-bus fail to install.  
I have confirmed that the hardware works by using i2cdetect -y 1, even went so far as to install a software i2c on bus 3 and confirmed that it also work.

pi@NanoView:~ $ i2cdetect -y 3  
0 1 2 3 4 5 6 7 8 9 a b c d e f  
00: -- -- -- -- -- -- -- -- -- -- -- -- --  
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --  
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --  
30: -- -- -- -- -- -- -- -- -- -- -- -- 3c -- -- --  
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --  
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --  
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --  
70: -- -- -- -- -- -- -- --  
But i am unable to install any node that use i2c-bus, not sure where to start looking.  
Please point me in the right direction.  
Here is the error log:  
2021-05-16T09:28:01.015Z Install : node-red-contrib-oled 0.2.1

2021-05-16T09:28:01.438Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production node-red-contrib-oled@0.2.1  
2021-05-16T09:28:33.077Z [out]  
2021-05-16T09:28:33.077Z [out] \> i2c-bus@5.2.2 install /home/pi/.node-red/node\_modules/i2c-bus  
2021-05-16T09:28:33.077Z [out] \> node-gyp rebuild  
2021-05-16T09:28:33.077Z [out]  
2021-05-16T09:28:42.638Z [out] make: Entering directory '/home/pi/.node-red/node\_modules/i2c-bus/build'  
2021-05-16T09:28:42.654Z [out] CXX(target) Release/obj.target/i2c/src/i2c.o  
2021-05-16T09:28:42.707Z [err] make: \*\*\* [i2c.target.mk:113: Release/obj.target/i2c/src/i2c.o] Segmentation fault  
2021-05-16T09:28:42.721Z [out] make: Leaving directory '/home/pi/.node-red/node\_modules/i2c-bus/build'  
2021-05-16T09:28:42.727Z [err] gyp  
2021-05-16T09:28:42.733Z [err]  
2021-05-16T09:28:42.735Z [err] ERR!  
2021-05-16T09:28:42.740Z [err] build error  
2021-05-16T09:28:42.746Z [err] gyp  
2021-05-16T09:28:42.749Z [err]  
2021-05-16T09:28:42.751Z [err] ERR!  
2021-05-16T09:28:42.756Z [err] stack Error: `make` failed with exit code: 2  
2021-05-16T09:28:42.756Z [err] gyp ERR! stack at ChildProcess.onExit (/usr/lib/node\_modules/npm/node\_modules/node-gyp/lib/build.js:194:23)  
2021-05-16T09:28:42.771Z [err] gyp ERR! stack at ChildProcess.emit (events.js:314:20)  
2021-05-16T09:28:42.771Z [err] gyp ERR! stack at Process.ChildProcess.\_handle.onexit (internal/child\_process.js:276:12)  
2021-05-16T09:28:42.771Z [err] gyp ERR! System Linux 5.10.17+  
2021-05-16T09:28:42.771Z [err] gyp ERR! command "/usr/bin/node" "/usr/lib/node\_modules/npm/node\_modules/node-gyp/bin/node-gyp.js" "rebuild"  
2021-05-16T09:28:42.771Z [err] gyp ERR! cwd /home/pi/.node-red/node\_modules/i2c-bus  
2021-05-16T09:28:42.774Z [err] gyp  
2021-05-16T09:28:42.775Z [err]  
2021-05-16T09:28:42.780Z [err] ERR! node -v v12.22.1  
2021-05-16T09:28:42.780Z [err] gyp ERR! node-gyp -v v5.1.0  
2021-05-16T09:28:42.780Z [err] gyp ERR! not ok  
2021-05-16T09:28:42.782Z [err]  
2021-05-16T09:28:45.008Z [err] npm  
2021-05-16T09:28:45.010Z [err]  
2021-05-16T09:28:45.012Z [err] ERR!  
2021-05-16T09:28:45.020Z [err] code ELIFECYCLE  
2021-05-16T09:28:45.020Z [err] npm ERR! errno 1  
2021-05-16T09:28:45.133Z [err] npm  
2021-05-16T09:28:45.135Z [err]  
2021-05-16T09:28:45.140Z [err] ERR! i2c-bus@5.2.2 install: `node-gyp rebuild`  
2021-05-16T09:28:45.140Z [err] npm ERR! Exit status 1  
2021-05-16T09:28:45.140Z [err] npm ERR!  
2021-05-16T09:28:45.142Z [err]  
2021-05-16T09:28:45.143Z [err] npm  
2021-05-16T09:28:45.150Z [err] ERR! Failed at the i2c-bus@5.2.2 install script.  
2021-05-16T09:28:45.150Z [err] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.  
2021-05-16T09:28:45.208Z [err]  
2021-05-16T09:28:45.210Z [err] npm  
2021-05-16T09:28:45.212Z [err]  
2021-05-16T09:28:45.219Z [err] ERR! A complete log of this run can be found in:  
2021-05-16T09:28:45.219Z [err] npm ERR! /home/pi/.npm/\_logs/2021-05-16T09\_28\_45\_172Z-debug.log  
2021-05-16T09:28:45.266Z rc=1

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [16 May 2021 10:13 UTC](https://discourse.nodered.org/t/i2c-bus-install-fail-rpi-zero-w/45713/2 "2021-05-16T10:13:53Z")

</div>

> [@Zodiac-69](#):
>
> make: \*\*\* [i2c.target.mk:113: Release/obj.target/i2c/src/i2c.o] Segmentation fault

Something is horribly wrong, you appear to have managed to get a segmentation fault running `make`.

Can you stop node-red then run it again in a terminal and copy/paste the startup log here please, that will give us some information on your system.  
Does the system run reliably apart from this issue?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [16 May 2021 10:27 UTC](https://discourse.nodered.org/t/i2c-bus-install-fail-rpi-zero-w/45713/3 "2021-05-16T10:27:40Z")

</div>

yes - i can only guess it ran out of memory while trying to do that. As @colin suggests try running the install manually from the `~/.node-red` directory - and paste the result here (if it fails again).

---

<div class="post-metadata">

**Author:** ![Zodiac-69](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zodiac-69/32/29022_2.png) [@Zodiac-69](https://discourse.nodered.org/u/Zodiac-69)\
**Post date:** [16 May 2021 10:35 UTC](https://discourse.nodered.org/t/i2c-bus-install-fail-rpi-zero-w/45713/4 "2021-05-16T10:35:50Z")

</div>

Hi dceejay

Here is the error from the terminal with NR not running.

pi@NanoView:~/.node-red $ npm install node-red-contrib-oled

> i2c-bus@5.2.2 install /home/pi/.node-red/node\_modules/i2c-bus  
> node-gyp rebuild

make: Entering directory '/home/pi/.node-red/node\_modules/i2c-bus/build'  
CXX(target) Release/obj.target/i2c/src/i2c.o  
make: \*\*\* [i2c.target.mk:113: Release/obj.target/i2c/src/i2c.o] Segmentation fault  
make: Leaving directory '/home/pi/.node-red/node\_modules/i2c-bus/build'  
gyp ERR! build error  
gyp ERR! stack Error: `make` failed with exit code: 2  
gyp ERR! stack at ChildProcess.onExit (/usr/lib/node\_modules/npm/node\_modules/node-gyp/lib/build.js:194:23)  
gyp ERR! stack at ChildProcess.emit (events.js:314:20)  
gyp ERR! stack at Process.ChildProcess.\_handle.onexit (internal/child\_process.js:276:12)  
gyp ERR! System Linux 5.10.17+  
gyp ERR! command "/usr/bin/node" "/usr/lib/node\_modules/npm/node\_modules/node-gyp/bin/node-gyp.js" "rebuild"  
gyp ERR! cwd /home/pi/.node-red/node\_modules/i2c-bus  
gyp ERR! node -v v12.22.1  
gyp ERR! node-gyp -v v5.1.0  
gyp ERR! not ok  
npm ERR! code ELIFECYCLE  
npm ERR! errno 1  
npm ERR! i2c-bus@5.2.2 install: `node-gyp rebuild`  
npm ERR! Exit status 1  
npm ERR!  
npm ERR! Failed at the i2c-bus@5.2.2 install script.  
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:  
npm ERR! /home/pi/.npm/\_logs/2021-05-16T10\_30\_24\_082Z-debug.log

---

<div class="post-metadata">

**Author:** ![Zodiac-69](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zodiac-69/32/29022_2.png) [@Zodiac-69](https://discourse.nodered.org/u/Zodiac-69)\
**Post date:** [16 May 2021 10:42 UTC](https://discourse.nodered.org/t/i2c-bus-install-fail-rpi-zero-w/45713/5 "2021-05-16T10:42:39Z")

</div>

Hi Colin

As far as i know, it is working fine, i am trying to add i2c to a flow, and this is where i am getting stuck.

Here is the NR Start log

pi@NanoView:~ $ node-red-start

Start Node-RED

Once Node-RED has started, point a browser at [http://192.168.2.50:1880](http://192.168.2.50:1880)  
On Pi Node-RED works better with the Firefox or Chrome browser

Use node-red-stop to stop Node-RED  
Use node-red-start to start Node-RED again  
Use node-red-log to view the recent log output  
Use sudo systemctl enable nodered.service to autostart Node-RED at every boot  
Use sudo systemctl disable nodered.service to disable autostart on boot

To find more nodes and example flows - go to [http://flows.nodered.org](http://flows.nodered.org)

# Starting as a systemd service. 16 May 12:39:52 - [info] Welcome to Node-RED

## 16 May 12:39:52 - [info] Node-RED version: v1.3.4 16 May 12:39:52 - [info] Node.js version: v12.22.1 16 May 12:39:52 - [info] Linux 5.10.17+ arm LE 16 May 12:39:56 - [info] Loading palette nodes redPlc rpi\_mcp23017 driver V1.0.6 (c) Ocean [iiot2k@gmail.com](mailto:iiot2k@gmail.com) 16 May 12:40:07 - [info] Dashboard version 2.29.0 started at /ui 16 May 12:40:08 - [info] Settings file : /home/pi/.node-red/settings.js 16 May 12:40:08 - [info] Context store : 'default' [module=memory] 16 May 12:40:08 - [info] User directory : /home/pi/.node-red 16 May 12:40:08 - [warn] Projects disabled : editorTheme.projects.enabled=false 16 May 12:40:08 - [info] Flows file : /home/pi/.node-red/flows\_NanoView.json 16 May 12:40:08 - [info] Server now running at [http://127.0.0.1:1880/](http://127.0.0.1:1880/) 16 May 12:40:08 - [warn]

## Your flow credentials file is encrypted using a system-generated key. If the system-generated key is lost for any reason, your credentials file will not be recoverable, you will have to delete it and re-enter your credentials. You should set your own key using the 'credentialSecret' option in your settings file. Node-RED will then re-encrypt your credentials file using your chosen key the next time you deploy a change.

16 May 12:40:09 - [info] Starting flows  
16 May 12:40:11 - [error] [mcp23017:@20] error on init  
16 May 12:40:12 - [info] Started flows  
16 May 12:40:12 - [error] [function:6062eda8.0c2414] TypeError: Cannot read property 'txt' of undefined  
16 May 12:40:12 - [info] [mqtt-broker:8bf8026a.48702] Connected to broker: mqtt://localhost:1883  
16 May 12:40:12 - [info] [function:6062eda8.0c2414] Status is =undefined

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [16 May 2021 10:51 UTC](https://discourse.nodered.org/t/i2c-bus-install-fail-rpi-zero-w/45713/6 "2021-05-16T10:51:20Z")

</div>

Very odd. Which version of raspbian are you running (use `cat /etc/os-release`)

Have you recently updated all the raspbian packages to make sure you are up to date?  
`sudo apt update && sudo apt full-upgrade`  
That updates all the packages to the latest available for the version of raspbian you are using, but does not update raspbian itself.

---

<div class="post-metadata">

**Author:** ![Zodiac-69](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zodiac-69/32/29022_2.png) [@Zodiac-69](https://discourse.nodered.org/u/Zodiac-69)\
**Post date:** [16 May 2021 10:54 UTC](https://discourse.nodered.org/t/i2c-bus-install-fail-rpi-zero-w/45713/7 "2021-05-16T10:54:27Z")

</div>

Hi Colin

pi@NanoView:~ $ cat /etc/os-release  
PRETTY\_NAME="Raspbian GNU/Linux 10 (buster)"  
NAME="Raspbian GNU/Linux"  
VERSION\_ID="10"  
VERSION="10 (buster)"  
VERSION\_CODENAME=buster  
ID=raspbian  
ID\_LIKE=debian  
HOME\_URL="[http://www.raspbian.org/](http://www.raspbian.org/)"  
SUPPORT\_URL="[RaspbianForums - Raspbian](http://www.raspbian.org/RaspbianForums)"  
BUG\_REPORT\_URL="[RaspbianBugs - Raspbian](http://www.raspbian.org/RaspbianBugs)"

`sudo apt update && sudo apt full-upgrade`  
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [16 May 2021 11:02 UTC](https://discourse.nodered.org/t/i2c-bus-install-fail-rpi-zero-w/45713/8 "2021-05-16T11:02:40Z")

</div>

Well I have no idea I am afraid. It installs fine on a Zero here, using nodejs 14 but I wouldn't expect it to be be the nodejs version that matters.

I suppose your `make` might be corrupted, you could try reinstalling that, I think it is installed by build-essential.  
`sudo apt remove build-essential`  
Make sure it has removed it by running `which make` which should not show anything, then  
`sudo apt install build-essential`

---

<div class="post-metadata">

**Author:** ![Zodiac-69](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zodiac-69/32/29022_2.png) [@Zodiac-69](https://discourse.nodered.org/u/Zodiac-69)\
**Post date:** [16 May 2021 14:35 UTC](https://discourse.nodered.org/t/i2c-bus-install-fail-rpi-zero-w/45713/9 "2021-05-16T14:35:48Z")

</div>

Hi Colin / dceejay

I decided to start "Fresh"...  
Install RPI lite, setup I2c, update and upgrade, install NR.

And now it works???  
Not sure why, as it is the same i did before, hate it when i don't know why it works now and not before.

Thank you for your time and assistance.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [16 May 2021 14:46 UTC](https://discourse.nodered.org/t/i2c-bus-install-fail-rpi-zero-w/45713/10 "2021-05-16T14:46:44Z")

</div>

Having had the problems you had before I think I would, if possible, have used a new good quality SD card and either ditched the original, or at least marked it as suspect.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [15 July 2021 14:47 UTC](https://discourse.nodered.org/t/i2c-bus-install-fail-rpi-zero-w/45713/11 "2021-07-15T14:47:02Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
