# Problem installing with npm the I2C modules - MCP23017

**URL:** <https://discourse.nodered.org/t/problem-installing-with-npm-the-i2c-modules-mcp23017/9860>\
**Category:** General\
**Created:** [7 April 2019 11:05 UTC](https://discourse.nodered.org/t/problem-installing-with-npm-the-i2c-modules-mcp23017/9860 "2019-04-07T11:05:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![TiaPreve](https://avatars.discourse-cdn.com/v4/letter/t/9fc29f/32.png) [@TiaPreve](https://discourse.nodered.org/u/TiaPreve)\
**Post date:** [7 April 2019 11:05 UTC](https://discourse.nodered.org/t/problem-installing-with-npm-the-i2c-modules-mcp23017/9860/1 "2019-04-07T11:05:09Z")

</div>

Hi there.

I'm trying to install the palette `node-red-contrib-mcp23017` in Node-Red.

What it returns to me is just errors both installing via Node-Red or using the npm mode in the .node-red directory.

I followed all the instructions written in the prerequisites in this page [https://flows.nodered.org/node/node-red-contrib-mcp23017](https://flows.nodered.org/node/node-red-contrib-mcp23017)

I installed the Node.js and then when I typed the command `npm install node-mcp23017 --save` it return to me the following error:

> 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\_modules/i2c/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:193:13)  
> gyp ERR! stack at Process.ChildProcess.\_handle.onexit (internal/child\_process.js:255:12)  
> gyp ERR! System Linux 4.19.32-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\_modules/i2c  
> gyp ERR! node -v v11.13.0  
> gyp ERR! node-gyp -v v3.8.0  
> gyp ERR! not ok  
> 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.
> 
> npm ERR! code ELIFECYCLE  
> npm ERR! errno 1  
> npm ERR! i2c@0.2.3 install: `node-gyp rebuild`  
> npm ERR! Exit status 1  
> npm ERR!  
> npm ERR! Failed at the i2c@0.2.3 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-07T11\_00\_04\_905Z-debug.log

I get this error for any kind on intallation for the I2C modules.  
Instead if I use the terminal to see the devices connected I can see them easily typing `i2cdetect -y 1`.  
I can't understand how to solve this problem to install this palette.

Anyone could please help me?

Thanks a lot.  
Mattia

---

<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 12:31 UTC](https://discourse.nodered.org/t/problem-installing-with-npm-the-i2c-modules-mcp23017/9860/2 "2019-04-07T12:31:14Z")

</div>

You are using nodejs v11, many third party libraries especially ones that need to be compiled won’t yet work with it.

Try installing nodejs v10 LTS (which is the recommended version for Node-RED anyway) and try again.

---

<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:** [7 April 2019 12:39 UTC](https://discourse.nodered.org/t/problem-installing-with-npm-the-i2c-modules-mcp23017/9860/3 "2019-04-07T12:39:58Z")

</div>

In fact if you are on a Pi then you are probably best to use the install script below, which will install compatible versions of everything.

---

<div class="post-metadata">

**Author:** ![TiaPreve](https://avatars.discourse-cdn.com/v4/letter/t/9fc29f/32.png) [@TiaPreve](https://discourse.nodered.org/u/TiaPreve)\
**Post date:** [7 April 2019 12:45 UTC](https://discourse.nodered.org/t/problem-installing-with-npm-the-i2c-modules-mcp23017/9860/4 "2019-04-07T12:45:32Z")

</div>

Thanks @ukmoose and @Colin

I installed the nodejs v10 with

> curl -sL [https://deb.nodesource.com/setup\_10.x](https://deb.nodesource.com/setup_10.x) | bash -  
> apt-get install -y nodejs

Unfortunately didn't change anything and still get this error below. I installed at the beginning Node-Red with the script provided on the node-red website and then just made `apt-get update` and `apt-get upgrade`

Should I chaange something? I'm using NPM directly into the folder node-red but I can't make it work.

> 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/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.19.32-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  
> 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@0.2.3 install: `node-gyp rebuild`  
> npm ERR! Exit status 1  
> npm ERR!  
> npm ERR! Failed at the i2c@0.2.3 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-07T12\_40\_14\_264Z-debug.log

Thanks for you help!

---

<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:** [7 April 2019 12:53 UTC](https://discourse.nodered.org/t/problem-installing-with-npm-the-i2c-modules-mcp23017/9860/5 "2019-04-07T12:53:16Z")

</div>

I see this has been reported, but I don't understand the comments about it.  
What OS are you using on the pi?

> <https://github.com/kaihenzler/node-mcp23017/issues/2>

---

<div class="post-metadata">

**Author:** ![TiaPreve](https://avatars.discourse-cdn.com/v4/letter/t/9fc29f/32.png) [@TiaPreve](https://discourse.nodered.org/u/TiaPreve)\
**Post date:** [7 April 2019 12:58 UTC](https://discourse.nodered.org/t/problem-installing-with-npm-the-i2c-modules-mcp23017/9860/6 "2019-04-07T12:58:11Z")

</div>

@Colin I'm running a Raspbian Stretch Lite on my Pi  
I already had a look mostly around internet but couldn't find anything that helped me out to solve this problem.  
Thanks

---

<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:** [7 April 2019 16:01 UTC](https://discourse.nodered.org/t/problem-installing-with-npm-the-i2c-modules-mcp23017/9860/7 "2019-04-07T16:01:32Z")

</div>

I suggest asking on that node's github.
