# Error installing i2c-bus for PCA9865 node

**URL:** <https://discourse.nodered.org/t/error-installing-i2c-bus-for-pca9865-node/9840>\
**Category:** General\
**Created:** [6 April 2019 16:24 UTC](https://discourse.nodered.org/t/error-installing-i2c-bus-for-pca9865-node/9840 "2019-04-06T16:24:14Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![mshaz](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mshaz/32/2294_2.png) [@mshaz](https://discourse.nodered.org/u/mshaz)\
**Post date:** [6 April 2019 16:24 UTC](https://discourse.nodered.org/t/error-installing-i2c-bus-for-pca9865-node/9840/1 "2019-04-06T16:24:14Z")

</div>

Hi i tried installing PCA9856 node but it needs i2c-bus and have this errors

pi@raspberrypi:~ $ sudo npm install -g i2c-bus

> i2c-bus@4.0.9 install /usr/lib/node\_modules/i2c-bus  
> node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/10.15.3"  
gyp WARN EACCES attempting to reinstall using temporary dev dir "/tmp/.node-gyp"  
gyp ERR! configure error  
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/lib/node\_modules/i2c-bus/build'  
gyp ERR! System Linux 4.14.98-v7+  
gyp ERR! command "/usr/bin/node" "/usr/lib/node\_modules/npm/node\_modules/node-gyp/bin/node-gyp.js" "rebuild"  
gyp ERR! cwd /usr/lib/node\_modules/i2c-bus  
gyp ERR! node -v v10.15.3  
gyp ERR! node-gyp -v v3.8.0  
gyp ERR! not ok  
npm ERR! code ELIFECYCLE  
npm ERR! errno 1  
npm ERR! i2c-bus@4.0.9 install: `node-gyp rebuild`  
npm ERR! Exit status 1  
npm ERR!  
npm ERR! Failed at the i2c-bus@4.0.9 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! /root/.npm/\_logs/2019-04-06T16\_13\_22\_138Z-debug.log

how do i resolve this?

Thank you

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [6 April 2019 16:41 UTC](https://discourse.nodered.org/t/error-installing-i2c-bus-for-pca9865-node/9840/2 "2019-04-06T16:41:52Z")

</div>

where have you downloaded the node from?

Does it say to use sudo?

---

<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:** [6 April 2019 17:17 UTC](https://discourse.nodered.org/t/error-installing-i2c-bus-for-pca9865-node/9840/3 "2019-04-06T17:17:19Z")

</div>

Which node red node is it that needs that? It should have installed it automatically.

---

<div class="post-metadata">

**Author:** ![mshaz](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mshaz/32/2294_2.png) [@mshaz](https://discourse.nodered.org/u/mshaz)\
**Post date:** [6 April 2019 17:36 UTC](https://discourse.nodered.org/t/error-installing-i2c-bus-for-pca9865-node/9840/4 "2019-04-06T17:36:30Z")

</div>

> **[i2c-bus](https://www.npmjs.com/package/i2c-bus)**
>
> I2C serial bus access with Node.js

i tried npm install i2c-bus i still have errors.

i m trying to install this node [https://flows.nodered.org/node/node-red-contrib-pca9685](https://flows.nodered.org/node/node-red-contrib-pca9685)

It's advisable to install the i2c package first. Refer to [The i2c npm page](https://www.npmjs.com/package/i2c) for more informations. This may require manual steps (e.g. enabling kernel modules). Please only proceed with this module once you've managed to properly install the i2c package, to simplify troubleshooting.

I tried installing i2c package as suggested i have node-gyp errors also so i m trying i2c-bus.

Thank you

---

<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:** [6 April 2019 20:00 UTC](https://discourse.nodered.org/t/error-installing-i2c-bus-for-pca9865-node/9840/5 "2019-04-06T20:00:30Z")

</div>

I don't see where in those instructions it says to use sudo or install it globally, but I don't think that is what is causing the errors. If you look in the issues on that node (i2c-bus) on github you will see others having similar problems, it seems it is not compatible with node 10.x. It has not been updated for three years and there does not seem to be any response to the mulitple issues raised against it. I think maybe there is a better i2c node, though I have no experience of them.

---

<div class="post-metadata">

**Author:** ![Andrei](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/andrei/32/10446_2.png) [@Andrei](https://discourse.nodered.org/u/Andrei)\
**Post date:** [7 April 2019 03:17 UTC](https://discourse.nodered.org/t/error-installing-i2c-bus-for-pca9865-node/9840/6 "2019-04-07T03:17:01Z")

</div>

> [@mshaz](#):
>
> pi@raspberrypi:~ $ sudo npm install -g i2c-bus

Is there a reason you installed using `sudo` ?

I just installed the library in the standard way. The installation was smooth and error free.

![r-01](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/9/9d2da179e84ea4059178b34ed56e34fd1f79aff3.png)

Running on a Raspberry pi:

> 7 Apr 04:02:29 - [info] Node-RED version: v0.19.5  
> 7 Apr 04:02:29 - [info] Node.js version: v10.14.1  
> 7 Apr 04:02:29 - [info] Linux 4.14.79-v7+ arm LE

---

<div class="post-metadata">

**Author:** ![mshaz](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mshaz/32/2294_2.png) [@mshaz](https://discourse.nodered.org/u/mshaz)\
**Post date:** [7 April 2019 08:19 UTC](https://discourse.nodered.org/t/error-installing-i2c-bus-for-pca9865-node/9840/7 "2019-04-07T08:19:49Z")

</div>

Hi Andrei ,

Can you help me to try install this ? [https://flows.nodered.org/node/node-red-contrib-pca9685](https://flows.nodered.org/node/node-red-contrib-pca9685)

I managed to install the i2c-bus seems not working with pca9685,  
npm install i2c i still cant install it.

Thank you

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [7 April 2019 08:25 UTC](https://discourse.nodered.org/t/error-installing-i2c-bus-for-pca9865-node/9840/8 "2019-04-07T08:25:55Z")

</div>

If you still can't install it after following the instructions what is the error message you see?

---

<div class="post-metadata">

**Author:** ![mrgrizzly](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@mrgrizzly](https://discourse.nodered.org/u/mrgrizzly)\
**Post date:** [7 April 2019 08:44 UTC](https://discourse.nodered.org/t/error-installing-i2c-bus-for-pca9865-node/9840/9 "2019-04-07T08:44:38Z")

</div>

Hey, i actually face the same issues on an Raspberry Pi.

> i2c.target.mk:99: recipe for target 'Release/obj.target/i2c/src/i2c.o' failed
> 
> make: \*\*\* [Release/obj.target/i2c/src/i2c.o] Error 1
> 
> 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:262:23)
> 
> gyp ERR! stack at ChildProcess.emit (events.js:189:13)
> 
> gyp ERR! stack at Process.ChildProcess.\_handle.onexit (internal/child\_process.js:248:12)
> 
> gyp ERR! System Linux 4.14.98-v7+
> 
> 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 v10.15.3
> 
> gyp ERR! node-gyp -v v3.8.0
> 
> gyp ERR! not ok
> 
> npm WARN node-red-project@0.0.1 No repository field.
> 
> npm WARN node-red-project@0.0.1 No license field.
> 
> npm ERR! code ELIFECYCLE
> 
> npm ERR! errno 1
> 
> npm ERR! i2c-bus@1.1.2 install: `node-gyp rebuild`
> 
> npm ERR! Exit status 1
> 
> npm ERR!
> 
> npm ERR! Failed at the i2c-bus@1.1.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/2019-04-07T08\_40\_46\_717Z-debug.log

I could help myself by downgrading the node version (with nvm) to v8.-ish.  
Then **node-red-contrib-pca9685** worked, however other nodes like **sqlite3**  
did not anymore. So downgrading is not an option for me.

---

<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:** [7 April 2019 08:55 UTC](https://discourse.nodered.org/t/error-installing-i2c-bus-for-pca9865-node/9840/10 "2019-04-07T08:55:17Z")

</div>

You would also need to remove and reinstall / rebuild sqlite node as that also needs to compile against the correct node version

---

<div class="post-metadata">

**Author:** ![mshaz](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mshaz/32/2294_2.png) [@mshaz](https://discourse.nodered.org/u/mshaz)\
**Post date:** [7 April 2019 09:34 UTC](https://discourse.nodered.org/t/error-installing-i2c-bus-for-pca9865-node/9840/11 "2019-04-07T09:34:28Z")

</div>

Hi thank you for the suggestions.

Its working fine now  
Thank you

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [7 April 2019 14:41 UTC](https://discourse.nodered.org/t/error-installing-i2c-bus-for-pca9865-node/9840/12 "2019-04-07T14:41:15Z")

</div>

So what did you end up doing to get it to work?

---

<div class="post-metadata">

**Author:** ![mshaz](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mshaz/32/2294_2.png) [@mshaz](https://discourse.nodered.org/u/mshaz)\
**Post date:** [7 April 2019 15:50 UTC](https://discourse.nodered.org/t/error-installing-i2c-bus-for-pca9865-node/9840/13 "2019-04-07T15:50:13Z")

</div>

I downgrade it as suggested by mrgrizzly above.

1. [https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally](https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally)

2. npm install i2c-bus

3. downgrade nodejs to v8.15.1  
[https://www.abeautifulsite.net/how-to-upgrade-or-downgrade-nodejs-using-npm](https://www.abeautifulsite.net/how-to-upgrade-or-downgrade-nodejs-using-npm)

4. Install node-red-contrib-pca9685 via node-red pallete

Thank you.

---

<div class="post-metadata">

**Author:** ![mshaz](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mshaz/32/2294_2.png) [@mshaz](https://discourse.nodered.org/u/mshaz)\
**Post date:** [8 April 2019 07:52 UTC](https://discourse.nodered.org/t/error-installing-i2c-bus-for-pca9865-node/9840/14 "2019-04-08T07:52:11Z")

</div>

The above steps seems to work with jessie bt not stretch. I fresh installed stretch n followed the steps i can install PCA9685 node but whn run it doesnt work. Hope there's better solutions

Thank you.

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [8 April 2019 08:11 UTC](https://discourse.nodered.org/t/error-installing-i2c-bus-for-pca9865-node/9840/15 "2019-04-08T08:11:36Z")

</div>

I would suggest you contact the author (as it is a contrib node) to make them aware of the issues you are having

---

<div class="post-metadata">

**Author:** ![ScheepersJohan](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/scheepersjohan/32/39556_2.png) [@ScheepersJohan](https://discourse.nodered.org/u/ScheepersJohan)\
**Post date:** [9 May 2019 12:21 UTC](https://discourse.nodered.org/t/error-installing-i2c-bus-for-pca9865-node/9840/16 "2019-05-09T12:21:00Z")

</div>

Have followed the steps but no luck, any suggestions?

**Step 1-3**

pi@6ftTank:~ $ mkdir ~/.npm-global  
pi@6ftTank:~ $ npm config set prefix '~/.npm-global'  
pi@6ftTank:~ $ export PATH=~/.npm-global/bin:$PATH  
pi@6ftTank:~ $ export PATH=~/.npm-global/bin:$PATH  
pi@6ftTank:~ $ source ~/.profile  
pi@6ftTank:~ $ npm install -g jshint  
/home/pi/.npm-global/bin/jshint -\> /home/pi/.npm-global/lib/node\_modules/jshint/bin/jshint

- jshint@2.10.2  
added 30 packages from 15 contributors in 9.733s  
pi@6ftTank:~ $ npm install i2c-bus

> i2c-bus@4.0.9 install /home/pi/node\_modules/i2c-bus  
> node-gyp rebuild

make: Entering directory '/home/pi/node\_modules/i2c-bus/build'  
CXX(target) Release/obj.target/i2c/src/i2c.o  
SOLINK\_MODULE(target) Release/obj.target/i2c.node  
COPY Release/i2c.node  
make: Leaving directory '/home/pi/node\_modules/i2c-bus/build'  
npm WARN saveError ENOENT: no such file or directory, open '/home/pi/package.json'  
npm WARN enoent ENOENT: no such file or directory, open '/home/pi/package.json'  
npm WARN pi No description  
npm WARN pi No repository field.  
npm WARN pi No README data  
npm WARN pi No license field.

- i2c-bus@4.0.9  
added 4 packages from 9 contributors and audited 7 packages in 23.351s  
found 0 vulnerabilities

pi@6ftTank:~ $ sudo npm cache clean -f  
npm WARN using --force I sure hope you know what you are doing.  
pi@6ftTank:~ $ sudo npm install -g n  
/usr/bin/n -\> /usr/lib/node\_modules/n/bin/n

- n@4.0.0  
added 1 package from 4 contributors in 1.673s  
pi@6ftTank:~ $ sudo n stable

pi@6ftTank:~ $ node -v  
v10.15.3

---

<div class="post-metadata">

**Author:** ![ScheepersJohan](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/scheepersjohan/32/39556_2.png) [@ScheepersJohan](https://discourse.nodered.org/u/ScheepersJohan)\
**Post date:** [9 May 2019 12:22 UTC](https://discourse.nodered.org/t/error-installing-i2c-bus-for-pca9865-node/9840/17 "2019-05-09T12:22:36Z")

</div>

**Step 4**  
fails

2019-05-09T12:12:43.990Z [err] gyp  
2019-05-09T12:12:43.990Z [err] ERR!  
2019-05-09T12:12:43.990Z [err]  
2019-05-09T12:12:43.990Z [err] node-gyp -v v3.8.0  
2019-05-09T12:12:43.991Z [err] gyp  
2019-05-09T12:12:43.991Z [err]  
2019-05-09T12:12:43.991Z [err] ERR!  
2019-05-09T12:12:43.991Z [err] not ok  
2019-05-09T12:12:45.046Z [err] npm  
2019-05-09T12:12:45.047Z [err] WARN node-red-project@0.0.1 No repository field.  
2019-05-09T12:12:45.047Z [err] npm  
2019-05-09T12:12:45.048Z [err] WARN  
2019-05-09T12:12:45.051Z [err] node-red-project@0.0.1 No license field.  
2019-05-09T12:12:45.051Z [err]  
2019-05-09T12:12:45.060Z [err] npm  
2019-05-09T12:12:45.060Z [err] ERR! code ELIFECYCLE  
2019-05-09T12:12:45.061Z [err] npm  
2019-05-09T12:12:45.061Z [err] ERR! errno 1  
2019-05-09T12:12:45.062Z [err] npm  
2019-05-09T12:12:45.063Z [err] ERR! i2c-bus@1.1.2 install: `node-gyp rebuild`  
2019-05-09T12:12:45.063Z [err] npm  
2019-05-09T12:12:45.063Z [err] ERR! Exit status 1  
2019-05-09T12:12:45.064Z [err] npm  
2019-05-09T12:12:45.065Z [err] ERR!  
2019-05-09T12:12:45.065Z [err] npm ERR! Failed at the i2c-bus@1.1.2 install script.  
2019-05-09T12:12:45.065Z [err] npm  
2019-05-09T12:12:45.065Z [err] ERR! This is probably not a problem with npm. There is likely additional logging output above.  
2019-05-09T12:12:45.201Z [err]  
2019-05-09T12:12:45.201Z [err] npm ERR! A complete log of this run can be found in:  
2019-05-09T12:12:45.201Z [err] npm ERR!  
2019-05-09T12:12:45.201Z [err] /home/pi/.npm/\_logs/2019-05-09T12\_12\_45\_077Z-debug.log  
2019-05-09T12:12:45.219Z rc=1

---

<div class="post-metadata">

**Author:** ![mshaz](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mshaz/32/2294_2.png) [@mshaz](https://discourse.nodered.org/u/mshaz)\
**Post date:** [9 May 2019 14:21 UTC](https://discourse.nodered.org/t/error-installing-i2c-bus-for-pca9865-node/9840/18 "2019-05-09T14:21:01Z")

</div>

Raspbian jessie or stretch? I used jessie, failed on stretch

---

<div class="post-metadata">

**Author:** ![ScheepersJohan](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/scheepersjohan/32/39556_2.png) [@ScheepersJohan](https://discourse.nodered.org/u/ScheepersJohan)\
**Post date:** [9 May 2019 18:45 UTC](https://discourse.nodered.org/t/error-installing-i2c-bus-for-pca9865-node/9840/19 "2019-05-09T18:45:54Z")

</div>

**Raspberry** Pi 3 Model B

PRETTY\_NAME="Raspbian GNU/Linux 9 (stretch)"  
NAME="Raspbian GNU/Linux"  
VERSION\_ID="9"  
VERSION="9 (stretch)"  
ID=raspbian  
ID\_LIKE=debian

---

<div class="post-metadata">

**Author:** ![tyeth](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tyeth/32/23442_2.png) [@tyeth](https://discourse.nodered.org/u/tyeth)\
**Post date:** [21 May 2020 21:44 UTC](https://discourse.nodered.org/t/error-installing-i2c-bus-for-pca9865-node/9840/20 "2020-05-21T21:44:21Z")

</div>

npm i -g arrowmeiwaracing/node-red-contrib-pca9685

Relying on a fork of the original module, updated in January, specifying i2c-bus at 5.x.x so will work for a while.

> **[arrowmeiwaracing/node-red-contrib-pca9685](https://github.com/arrowmeiwaracing/node-red-contrib-pca9685)**
>
> Node-RED node for the NXP PCA9685 PWM Controller. Contribute to arrowmeiwaracing/node-red-contrib-pca9685 development by creating an account on GitHub.

[Next page](https://discourse.nodered.org/t/error-installing-i2c-bus-for-pca9865-node/9840.md?page=2)
