How to install and usse "node-red-contrib-mcp23017"

Hello everyone,

I would like to know how to install the node-red-contrib-mcp23017 node

https://flows.nodered.org/node/node-red-contrib-mcp23017
but I only get error messages when I try to install it.

I don't understand how to install the extra modules,

https://github.com/kaihenzler/node-mcp23017

So what are the error messages? Please cut and paste them here...

gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/share/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.14.79-v7+
gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/pi/.node-red/node_modules/node-red-contrib-mcp23017/node_modules/node-mcp23017/node_modules/i2c
gyp ERR! node -v v8.11.1
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR! i2c@0.1.4 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the i2c@0.1.4 install script.
npm ERR! This is most likely a problem with the i2c package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls i2c
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 4.14.79-v7+
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "node-red-contrib-mcp23017"
npm ERR! cwd /home/pi/.node-red
npm ERR! node -v v8.11.1
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/pi/.node-red/npm-debug.log
npm ERR! not ok code 0
pi@raspberrypi:~/.node-red $

Error log 1
> pi@raspberrypi:~ $ cd ~/.node-red
> pi@raspberrypi:~/.node-red $ npm install node-red-contrib-mcp23017
> (node:1378) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
> npm WARN deprecated coffee-script@1.3.3: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
> /
> > i2c@0.1.4 install /home/pi/.node-red/node_modules/node-red-contrib-mcp23017/node_modules/node-mcp23017/node_modules/i2c
> > node-gyp rebuild
> 
> make: Entering directory '/home/pi/.node-red/node_modules/node-red-contrib-mcp23017/node_modules/node-mcp23017/node_modules/i2c/build'
>   CXX(target) Release/obj.target/i2c/src/i2c.o
> ../src/i2c.cc: In function ‘void setAddress(int8_t)’:
> ../src/i2c.cc:21:28: error: ‘New’ is not a member of ‘v8::String’
>        Exception::TypeError(String::New("Failed to set address"))
>                             ^~~~~~
> ../src/i2c.cc:22:5: error: ‘ThrowException’ was not declared in this scope
>      );
>      ^
> ../src/i2c.cc: At global scope:
> ../src/i2c.cc:26:32: error: ‘Arguments’ does not name a type
>  Handle<Value> SetAddress(const Arguments& args) {
>                                 ^~~~~~~~~
> ../src/i2c.cc: In function ‘v8::Handle<v8::Value> SetAddress(const int&)’:
> ../src/i2c.cc:27:15: error: ‘v8::HandleScope::HandleScope()’ is protected within this context
>    HandleScope scope;
>                ^~~~~
> In file included from /usr/include/nodejs/src/node.h:63:0,
>                  from ../src/i2c.cc:1:
> /usr/include/nodejs/deps/v8/include/v8.h:875:13: note: declared protected here
>    V8_INLINE HandleScope() {}
>              ^~~~~~~~~~~
> ../src/i2c.cc:29:16: error: invalid types ‘const int[int]’ for array subscript
>    addr = args[0]->Int32Value();
>                 ^
> ../src/i2c.cc:32:16: error: ‘class v8::HandleScope’ has no member named ‘Close’
>    return scope.Close(Undefined());
>                 ^~~~~
> ../src/i2c.cc:32:32: error: too few arguments to function ‘v8::Local<v8::Primitive> v8::Undefined(v8::Isolate*)’
>    return scope.Close(Undefined());
>                                 ^
> In file included from /usr/include/nodejs/src/node.h:63:0,
>                  from ../src/i2c.cc:1:
> /usr/include/nodejs/deps/v8/include/v8.h:313:27: note: declared here
>    friend Local<Primitive> Undefined(Isolate* isolate);
>                            ^~~~~~~~~
> ../src/i2c.cc: At global scope:
> ../src/i2c.cc:35:26: error: ‘Arguments’ does not name a type
>  Handle<Value> Scan(const Arguments& args) {
>                           ^~~~~~~~~
> ../src/i2c.cc: In function ‘v8::Handle<v8::Value> Scan(const int&)’:
> ../src/i2c.cc:36:15: error: ‘v8::HandleScope::HandleScope()’ is protected within this context
>    HandleScope scope;
>                ^~~~~
> In file included from /usr/include/nodejs/src/node.h:63:0,
>                  from ../src/i2c.cc:1:
> /usr/include/nodejs/deps/v8/include/v8.h:875:13: note: declared protected here
>    V8_INLINE HandleScope() {}
>              ^~~~~~~~~~~
> ../src/i2c.cc:39:58: error: invalid types ‘const int[int]’ for array subscript
>    Local<Function> callback = Local<Function>::Cast(args[0]);
>                                                           ^
> ../src/i2c.cc:40:38: error: invalid conversion from ‘int’ to ‘v8::Isolate*’ [-fpermissive]
>    Local<Array> results(Array::New(128));
>                                       ^
> In file included from /usr/include/nodejs/src/node.h:63:0,
>                  from ../src/i2c.cc:1:
> /usr/include/nodejs/deps/v8/include/v8.h:3524:23: note:   initializing argument 1 of ‘static v8::Local<v8::Array> v8::Array::New(v8::Isolate*, int)’
>    static Local<Array> New(Isolate* isolate, int length = 0);
>                        ^~~
> ../src/i2c.cc:41:45: error: too few arguments to function ‘v8::Local<v8::Primitive> v8::Null(v8::Isolate*)’
>    Local<Value> err = Local<Value>::New(Null());
>                                              ^
> In file included from /usr/include/nodejs/src/node.h:63:0,
>                  from ../src/i2c.cc:1:
> /usr/include/nodejs/deps/v8/include/v8.h:314:27: note: declared here
>    friend Local<Primitive> Null(Isolate* isolate);
>                            ^~~~
> ../src/i2c.cc:53:37: error: no matching function for call to ‘v8::Integer::New(int&)’
>      results->Set(i, Integer::New(res));
>                                      ^
> In file included from /usr/include/nodejs/src/node.h:63:0,
>                  from ../src/i2c.cc:1:
> /usr/include/nodejs/deps/v8/include/v8.h:2929:25: note: candidate: static v8::Local<v8::Integer> v8::Integer::New(v8::Isolate*, int32_t)
>    static Local<Integer> New(Isolate* isolate, int32_t value);
>                          ^~~
> /usr/include/nodejs/deps/v8/include/v8.h:2929:25: note:   candidate expects 2 arguments, 1 provided
> ../src/i2c.cc:60:18: error: ‘GetCurrent’ is not a member of ‘v8::Context’
>    callback->Call(Context::GetCurrent()->Global(), argc, argv);
>                   ^~~~~~~
> ../src/i2c.cc:62:16: error: ‘class v8::HandleScope’ has no member named ‘Close’
>    return scope.Close(results);
>                 ^~~~~
> ../src/i2c.cc: At global scope:
> ../src/i2c.cc:65:27: error: ‘Arguments’ does not name a type
>  Handle<Value> Close(const Arguments& args) {
>                            ^~~~~~~~~
> ../src/i2c.cc: In function ‘v8::Handle<v8::Value> Close(const int&)’:
> ../src/i2c.cc:66:15: error: ‘v8::HandleScope::HandleScope()’ is protected within this context
>    HandleScope scope;
>                ^~~~~
> In file included from /usr/include/nodejs/src/node.h:63:0,
>                  from ../src/i2c.cc:1:
> /usr/include/nodejs/deps/v8/include/v8.h:875:13: note: declared protected here
>    V8_INLINE HandleScope() {}
>              ^~~~~~~~~~~
> ../src/i2c.cc:71:16: error: ‘class v8::HandleScope’ has no member named ‘Close’
>    return scope.Close(Undefined());
>                 ^~~~~
> ../src/i2c.cc:71:32: error: too few arguments to function ‘v8::Local<v8::Primitive> v8::Undefined(v8::Isolate*)’
>    return scope.Close(Undefined());
>                                 ^
> In file included from /usr/include/nodejs/src/node.h:63:0,
>                  from ../src/i2c.cc:1:
> /usr/include/nodejs/deps/v8/include/v8.h:313:27: note: declared here
>    friend Local<Primitive> Undefined(Isolate* isolate);
>                            ^~~~~~~~~
> ../src/i2c.cc: At global scope:
> ../src/i2c.cc:74:26: error: ‘Arguments’ does not name a type
>  Handle<Value> Open(const Arguments& args) {
>                           ^~~~~~~~~
> ../src/i2c.cc: In function ‘v8::Handle<v8::Value> Open(const int&)’:
> ../src/i2c.cc:75:15: error: ‘v8::HandleScope::HandleScope()’ is protected within this context
>    HandleScope scope;
>                ^~~~~
> In file included from /usr/include/nodejs/src/node.h:63:0,
>                  from ../src/i2c.cc:1:
> /usr/include/nodejs/deps/v8/include/v8.h:875:13: note: declared protected here
>    V8_INLINE HandleScope() {}
>              ^~~~~~~~~~~
> ../src/i2c.cc:77:34: error: invalid types ‘const int[int]’ for array subscript
>    String::Utf8Value device(args[0]);
>                                   ^
> ../src/i2c.cc:79:45: error: too few arguments to function ‘v8::Local<v8::Primitive> v8::Null(v8::Isolate*)’
>    Local<Value> err = Local<Value>::New(Null());
>                                              ^
> In file included from /usr/include/nodejs/src/node.h:63:0,
>                  from ../src/i2c.cc:1:
> /usr/include/nodejs/deps/v8/include/v8.h:314:27: note: declared here
>    friend Local<Primitive> Null(Isolate* isolate);
>                            ^~~~
> ../src/i2c.cc:83:28: error: ‘New’ is not a member of ‘v8::String’
>      err = Exception::Error(String::New("Failed to open I2C device"));
>                             ^~~~~~
> ../src/i2c.cc:86:13: error: invalid types ‘const int[int]’ for array subscript
>    if (args[1]->IsFunction()) {
>              ^
> ../src/i2c.cc:88:60: error: invalid types ‘const int[int]’ for array subscript
>      Local<Function> callback = Local<Function>::Cast(args[1]);
>                                                             ^
> ../src/i2c.cc:91:20: error: ‘GetCurrent’ is not a member of ‘v8::Context’
>      callback->Call(Context::GetCurrent()->Global(), argc, argv);
>                     ^~~~~~~
> ../src/i2c.cc:94:16: error: ‘class v8::HandleScope’ has no member named ‘Close’
>    return scope.Close(Undefined());
>                 ^~~~~
> ../src/i2c.cc:94:32: error: too few arguments to function ‘v8::Local<v8::Primitive> v8::Undefined(v8::Isolate*)’
>    return scope.Close(Undefined());
>                                 ^
> In file included from /usr/include/nodejs/src/node.h:63:0,
>                  from ../src/i2c.cc:1:
> /usr/include/nodejs/deps/v8/include/v8.h:313:27: note: declared here
>    friend Local<Primitive> Undefined(Isolate* isolate);
>                            ^~~~~~~~~
> ../src/i2c.cc: At global scope:
> ../src/i2c.cc:97:30: error: ‘Arguments’ does not name a type
>  Handle<Value> ReadByte(const Arguments& args) {
>                               ^~~~~~~~~
> ../src/i2c.cc: In function ‘v8::Handle<v8::Value> ReadByte(const int&)’:
> ../src/i2c.cc:98:15: error: ‘v8::HandleScope::HandleScope()’ is protected within this context
>    HandleScope scope;
>                ^~~~~
> In file included from /usr/include/nodejs/src/node.h:63:0,
>                  from ../src/i2c.cc:1:
> /usr/include/nodejs/deps/v8/include/v8.h:875:13: note: declared protected here
>    V8_INLINE HandleScope() {}
>              ^~~~~~~~~~~
> ../src/i2c.cc:101:45: error: too few arguments to function ‘v8::Local<v8::Primitive> v8::Null(v8::Isolate*)’
>    Local<Value> err = Local<Value>::New(Null());
>                                              ^
> In file included from /usr/include/nodejs/src/node.h:63:0,
>                  from ../src/i2c.cc:1:
> /usr/include/nodejs/deps/v8/include/v8.h:314:27: note: declared here
>    friend Local<Primitive> Null(Isolate* isolate);
>                            ^~~~
> ../src/i2c.cc:106:28: error: ‘New’ is not a member of ‘v8::String’
>      err = Exception::Error(String::New("Cannot read device"));
>                             ^~~~~~
> ../src/i2c.cc:108:28: error: no matching function for call to ‘v8::Integer::New(int8_t&)’
>      data = Integer::New(res);
>                             ^
> In file included from /usr/include/nodejs/src/node.h:63:0,
>                  from ../src/i2c.cc:1:
> /usr/include/nodejs/deps/v8/include/v8.h:2929:25: note: candidate: static v8::Local<v8::Integer> v8::Integer::New(v8::Isolate*, int32_t)
>    static Local<Integer> New(Isolate* isolate, int32_t value);
>                          ^~~
> /usr/include/nodejs/deps/v8/include/v8.h:2929:25: note:   candidate expects 2 arguments, 1 provided
> ../src/i2c.cc:111:13: error: invalid types ‘const int[int]’ for array subscript
>    if (args[0]->IsFunction()) {
>              ^
> ../src/i2c.cc:113:60: error: invalid types ‘const int[int]’ for array subscript
>      Local<Function> callback = Local<Function>::Cast(args[0]);
>                                                             ^
> ../src/i2c.cc:116:20: error: ‘GetCurrent’ is not a member of ‘v8::Context’
>      callback->Call(Context::GetCurrent()->Global(), argc, argv);
>                     ^~~~~~~
> ../src/i2c.cc:118:16: error: ‘class v8::HandleScope’ has no member named ‘Close’
>    return scope.Close(data);
>                 ^~~~~
> ../src/i2c.cc: At global scope:
> ../src/i2c.cc:121:31: error: ‘Arguments’ does not name a type
>  Handle<Value> ReadBlock(const Arguments& args) {
>                                ^~~~~~~~~
> ../src/i2c.cc: In function ‘v8::Handle<v8::Value> ReadBlock(const int&)’:
> ../src/i2c.cc:122:15: error: ‘v8::HandleScope::HandleScope()’ is protected within this context
>    HandleScope scope;
>                ^~~~~
> In file included from /usr/include/nodejs/src/node.h:63:0,
>                  from ../src/i2c.cc:1:
> /usr/include/nodejs/deps/v8/include/v8.h:875:13: note: declared protected here
>    V8_INLINE HandleScope() {}
>              ^~~~~~~~~~~
> ../src/i2c.cc:124:22: error: invalid types ‘const int[int]’ for array subscript
>    int8_t cmd = args[0]->Int32Value();
>                       ^
> ../src/i2c.cc:125:23: error: invalid types ‘const int[int]’ for array subscript
>    int32_t len = args[1]->Int32Value();
>                        ^
> ../src/i2c.cc:127:45: error: too few arguments to function ‘v8::Local<v8::Primitive> v8::Null(v8::Isolate*)’
>    Local<Value> err = Local<Value>::New(Null());
>                                              ^
> In file included from /usr/include/nodejs/src/node.h:63:0,
>                  from ../src/i2c.cc:1:
> /usr/include/nodejs/deps/v8/include/v8.h:314:27: note: declared here
>    friend Local<Primitive> Null(Isolate* isolate);
>                            ^~~~
> ../src/i2c.cc:128:16: error: expected primary-expression before ‘*’ token
>    node::Buffer *buffer =  node::Buffer::New(len);
>                 ^
> ../src/i2c.cc:128:17: error: ‘buffer’ was not declared in this scope
>    node::Buffer *buffer =  node::Buffer::New(len);
>                  ^~~~~~
> ../src/i2c.cc:128:48: error: no matching function for call to ‘New(int32_t&)’
>    node::Buffer *buffer =  node::Buffer::New(len);
>                                                 ^
> In file included from ../src/i2c.cc:2:0:
> /usr/include/nodejs/src/node_buffer.h:52:40: note: candidate: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, size_t)
>  NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate, size_t length);
>                                         ^~~
> /usr/include/nodejs/src/node_buffer.h:52:40: note:   candidate expects 2 arguments, 1 provided
> /usr/include/nodejs/src/node_buffer.h:55:40: note: candidate: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, v8::Local<v8::String>, node::encoding)
>  NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
>                                         ^~~
> /usr/include/nodejs/src/node_buffer.h:55:40: note:   candidate expects 3 arguments, 1 provided
> /usr/include/nodejs/src/node_buffer.h:60:40: note: candidate: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, char*, size_t, node::Buffer::FreeCallback, void*)
>  NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
>                                         ^~~
> /usr/include/nodejs/src/node_buffer.h:60:40: note:   candidate expects 5 arguments, 1 provided
> /usr/include/nodejs/src/node_buffer.h:67:40: note: candidate: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, char*, size_t)
>  NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
>                                         ^~~
> /usr/include/nodejs/src/node_buffer.h:67:40: note:   candidate expects 3 arguments, 1 provided
> ../src/i2c.cc:130:29: error: ‘GetCurrent’ is not a member of ‘v8::Context’
>    Local<Object> globalObj = Context::GetCurrent()->Global();
>                              ^~~~~~~
> ../src/i2c.cc:131:76: error: ‘New’ is not a member of ‘v8::String’
>  <Function> bufferConstructor = Local<Function>::Cast(globalObj->Get(String::New("Buffer")));
>                                                                      ^~~~~~
> ../src/i2c.cc:132:77: error: no matching function for call to ‘v8::Integer::New(int32_t&)’
>  <Value> constructorArgs[3] = { buffer->handle_, v8::Integer::New(len), v8::Integer::New(0) };
>                                                                      ^
> In file included from /usr/include/nodejs/src/node.h:63:0,
>                  from ../src/i2c.cc:1:
> /usr/include/nodejs/deps/v8/include/v8.h:2929:25: note: candidate: static v8::Local<v8::Integer> v8::Integer::New(v8::Isolate*, int32_t)
>    static Local<Integer> New(Isolate* isolate, int32_t value);
>                          ^~~
> /usr/include/nodejs/deps/v8/include/v8.h:2929:25: note:   candidate expects 2 arguments, 1 provided
> ../src/i2c.cc:132:98: error: no matching function for call to ‘v8::Integer::New(int)’
>  uctorArgs[3] = { buffer->handle_, v8::Integer::New(len), v8::Integer::New(0) };
>                                                                             ^
> In file included from /usr/include/nodejs/src/node.h:63:0,
>                  from ../src/i2c.cc:1:
> /usr/include/nodejs/deps/v8/include/v8.h:2929:25: note: candidate: static v8::Local<v8::Integer> v8::Integer::New(v8::Isolate*, int32_t)
>    static Local<Integer> New(Isolate* isolate, int32_t value);
>                          ^~~
> /usr/include/nodejs/deps/v8/include/v8.h:2929:25: note:   candidate expects 2 arguments, 1 provided
> ../src/i2c.cc:133:81: warning: ‘v8::Local<v8::Object> v8::Function::NewInstance(int, v8::Local<v8::Value>*) const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
>  ocal<Object> actualBuffer = bufferConstructor->NewInstance(3, constructorArgs);
>                                                                               ^
> In file included from /usr/include/nodejs/deps/v8/include/v8.h:26:0,
>                  from /usr/include/nodejs/src/node.h:63,
>                  from ../src/i2c.cc:1:
> /usr/include/nodejs/deps/v8/include/v8.h:3847:31: note: declared here
>                  Local<Object> NewInstance(int argc, Local<Value> argv[]) const);
>                                ^
> /usr/include/nodejs/deps/v8/include/v8config.h:318:3: note: in definition of macro ‘V8_DEPRECATED’
>    declarator __attribute__((deprecated(message)))
>    ^~~~~~~~~~
> ../src/i2c.cc:137:30: error: ‘New’ is not a member of ‘v8::String’
>        err = Exception::Error(String::New("Error reading length of bytes"));
>                               ^~~~~~
> ../src/i2c.cc:142:15: error: invalid types ‘const int[int]’ for array subscript
>      if (args[3]->IsFunction()) {
>                ^
> ../src/i2c.cc:144:62: error: invalid types ‘const int[int]’ for array subscript
>        Local<Function> callback = Local<Function>::Cast(args[3]);
>                                                               ^
> ../src/i2c.cc:146:22: error: ‘GetCurrent’ is not a member of ‘v8::Context’
>        callback->Call(Context::GetCurrent()->Global(), argc, argv);
>                       ^~~~~~~
> ../src/i2c.cc:149:15: error: invalid types ‘const int[int]’ for array subscript
>      if (args[2]->IsNumber()) {
>                ^
> ../src/i2c.cc:150:29: error: invalid types ‘const int[int]’ for array subscript
>        int32_t delay = args[2]->Int32Value();
>                              ^
> ../src/i2c.cc:156:16: error: ‘class v8::HandleScope’ has no member named ‘Close’
>    return scope.Close(actualBuffer);
>                 ^~~~~
> ../src/i2c.cc: At global scope:
> ../src/i2c.cc:160:31: error: ‘Arguments’ does not name a type
>  Handle<Value> WriteByte(const Arguments& args) {
>                                ^~~~~~~~~
> ../src/i2c.cc: In function ‘v8::Handle<v8::Value> WriteByte(const int&)’:
> ../src/i2c.cc:161:15: error: ‘v8::HandleScope::HandleScope()’ is protected within this context
>    HandleScope scope;
>                ^~~~~
> In file included from /usr/include/nodejs/src/node.h:63:0,
>                  from ../src/i2c.cc:1:
> /usr/include/nodejs/deps/v8/include/v8.h:875:13: note: declared protected here
>    V8_INLINE HandleScope() {}
>              ^~~~~~~~~~~
> ../src/i2c.cc:163:23: error: invalid types ‘const int[int]’ for array subscript
>    int8_t byte = args[0]->Int32Value();
>                        ^
> ../src/i2c.cc:164:45: error: too few arguments to function ‘v8::Local<v8::Primitive> v8::Null(v8::Isolate*)’
>    Local<Value> err = Local<Value>::New(Null());
>                                              ^
> In file included from /usr/include/nodejs/src/node.h:63:0,
>                  from ../src/i2c.cc:1:
> /usr/include/nodejs/deps/v8/include/v8.h:314:27: note: declared here
>    friend Local<Primitive> Null(Isolate* isolate);
>                            ^~~~
> ../src/i2c.cc:167:28: error: ‘New’ is not a member of ‘v8::String’
>      err = Exception::Error(String::New("Cannot write to device"));
>                             ^~~~~~
> ../src/i2c.cc:170:13: error: invalid types ‘const int[int]’ for array subscript
>    if (args[1]->IsFunction()) {
>              ^
> ../src/i2c.cc:172:60: error: invalid types ‘const int[int]’ for array subscript
>      Local<Function> callback = Local<Function>::Cast(args[1]);
>                                                             ^
> ../src/i2c.cc:175:20: error: ‘GetCurrent’ is not a member of ‘v8::Context’
>      callback->Call(Context::GetCurrent()->Global(), argc, argv);
>                     ^~~~~~~
> ../src/i2c.cc:178:16: error: ‘class v8::HandleScope’ has no member named ‘Close’
>    return scope.Close(Undefined());
>                 ^~~~~
> ../src/i2c.cc:178:32: error: too few arguments to function ‘v8::Local<v8::Primitive> v8::Undefined(v8::Isolate*)’
>    return scope.Close(Undefined());
>                                 ^
> In file included from /usr/include/nodejs/src/node.h:63:0,
>                  from ../src/i2c.cc:1:
> /usr/include/nodejs/deps/v8/include/v8.h:313:27: note: declared here
>    friend Local<Primitive> Undefined(Isolate* isolate);
>                            ^~~~~~~~~
> ../src/i2c.cc: At global scope:
> ../src/i2c.cc:181:32: error: ‘Arguments’ does not name a type
>  Handle<Value> WriteBlock(const Arguments& args) {
>                                 ^~~~~~~~~
> ../src/i2c.cc: In function ‘v8::Handle<v8::Value> WriteBlock(const int&)’:
> ../src/i2c.cc:182:15: error: ‘v8::HandleScope::HandleScope()’ is protected within this context
>    HandleScope scope;
>                ^~~~~
> In file included from /usr/include/nodejs/src/node.h:63:0,
>                  from ../src/i2c.cc:1:
> /usr/include/nodejs/deps/v8/include/v8.h:875:13: note: declared protected here
>    V8_INLINE HandleScope() {}
>              ^~~~~~~~~~~
> ../src/i2c.cc:184:31: error: invalid types ‘const int[int]’ for array subscript
>    Local<Value> buffer = args[1];
>                                ^
> ../src/i2c.cc:186:22: error: invalid types ‘const int[int]’ for array subscript
>    int8_t cmd = args[0]->Int32Value();
>                       ^
> ../src/i2c.cc:190:45: error: too few arguments to function ‘v8::Local<v8::Primitive> v8::Null(v8::Isolate*)’
>    Local<Value> err = Local<Value>::New(Null());
>                                              ^
> In file included from /usr/include/nodejs/src/node.h:63:0,
>                  from ../src/i2c.cc:1:
> /usr/include/nodejs/deps/v8/include/v8.h:314:27: note: declared here
>    friend Local<Primitive> Null(Isolate* isolate);
>                            ^~~~
> ../src/i2c.cc:193:28: error: ‘New’ is not a member of ‘v8::String’
>      err = Exception::Error(String::New("Cannot write to device"));
>                             ^~~~~~
> ../src/i2c.cc:196:13: error: invalid types ‘const int[int]’ for array subscript
>    if (args[2]->IsFunction()) {
>              ^
> ../src/i2c.cc:198:60: error: invalid types ‘const int[int]’ for array subscript
>      Local<Function> callback = Local<Function>::Cast(args[2]);
>                                                             ^
> ../src/i2c.cc:201:20: error: ‘GetCurrent’ is not a member of ‘v8::Context’
>      callback->Call(Context::GetCurrent()->Global(), argc, argv);
>                     ^~~~~~~
> ../src/i2c.cc:204:16: error: ‘class v8::HandleScope’ has no member named ‘Close’
>    return scope.Close(Undefined());
>                 ^~~~~
> ../src/i2c.cc:204:32: error: too few arguments to function ‘v8::Local<v8::Primitive> v8::Undefined(v8::Isolate*)’
>    return scope.Close(Undefined());
>                                 ^
> In file included from /usr/include/nodejs/src/node.h:63:0,
>                  from ../src/i2c.cc:1:
> /usr/include/nodejs/deps/v8/include/v8.h:313:27: note: declared here
>    friend Local<Primitive> Undefined(Isolate* isolate);
>                            ^~~~~~~~~
> ../src/i2c.cc: At global scope:
> ../src/i2c.cc:207:31: error: ‘Arguments’ does not name a type
>  Handle<Value> WriteWord(const Arguments& args) {
>                                ^~~~~~~~~
> ../src/i2c.cc: In function ‘v8::Handle<v8::Value> WriteWord(const int&)’:
> ../src/i2c.cc:208:15: error: ‘v8::HandleScope::HandleScope()’ is protected within this context
>    HandleScope scope;
>                ^~~~~
> In file included from /usr/include/nodejs/src/node.h:63:0,
>                  from ../src/i2c.cc:1:
> /usr/include/nodejs/deps/v8/include/v8.h:875:13: note: declared protected here
>    V8_INLINE HandleScope() {}
>              ^~~~~~~~~~~
> ../src/i2c.cc:210:22: error: invalid types ‘const int[int]’ for array subscript
>    int8_t cmd = args[0]->Int32Value();
>                       ^
> ../src/i2c.cc:211:24: error: invalid types ‘const int[int]’ for array subscript
>    int16_t word = args[1]->Int32Value();
Error Log 2
>                     ^
> ../src/i2c.cc:213:45: error: too few arguments to function ‘v8::Local<v8::Primitive> v8::Null(v8::Isolate*)’
>    Local<Value> err = Local<Value>::New(Null());
>                                              ^
> In file included from /usr/include/nodejs/src/node.h:63:0,
>                  from ../src/i2c.cc:1:
> /usr/include/nodejs/deps/v8/include/v8.h:314:27: note: declared here
>    friend Local<Primitive> Null(Isolate* isolate);
>                            ^~~~
> ../src/i2c.cc:216:28: error: ‘New’ is not a member of ‘v8::String’
>      err = Exception::Error(String::New("Cannot write to device"));
>                             ^~~~~~
> ../src/i2c.cc:219:13: error: invalid types ‘const int[int]’ for array subscript
>    if (args[2]->IsFunction()) {
>              ^
> ../src/i2c.cc:221:60: error: invalid types ‘const int[int]’ for array subscript
>      Local<Function> callback = Local<Function>::Cast(args[2]);
>                                                             ^
> ../src/i2c.cc:224:20: error: ‘GetCurrent’ is not a member of ‘v8::Context’
>      callback->Call(Context::GetCurrent()->Global(), argc, argv);
>                     ^~~~~~~
> ../src/i2c.cc:227:16: error: ‘class v8::HandleScope’ has no member named ‘Close’
>    return scope.Close(Undefined());
>                 ^~~~~
> ../src/i2c.cc:227:32: error: too few arguments to function ‘v8::Local<v8::Primitive> v8::Undefined(v8::Isolate*)’
>    return scope.Close(Undefined());
>                                 ^
> In file included from /usr/include/nodejs/src/node.h:63:0,
>                  from ../src/i2c.cc:1:
> /usr/include/nodejs/deps/v8/include/v8.h:313:27: note: declared here
>    friend Local<Primitive> Undefined(Isolate* isolate);
>                            ^~~~~~~~~
> ../src/i2c.cc: In function ‘void Init(v8::Handle<v8::Object>)’:
> ../src/i2c.cc:231:15: error: ‘NewSymbol’ is not a member of ‘v8::String’
>    target->Set(String::NewSymbol("scan"),
>                ^~~~~~
> ../src/i2c.cc:232:31: error: no matching function for call to ‘v8::FunctionTemplate::New(v8::Handle<v8::Value> (&)(const int&))’
>      FunctionTemplate::New(Scan)->GetFunction());
>                                ^
> In file included from /usr/include/nodejs/src/node.h:63:0,
>                  from ../src/i2c.cc:1:
> /usr/include/nodejs/deps/v8/include/v8.h:5445:34: note: candidate: static v8::Local<v8::FunctionTemplate> v8::FunctionTemplate::New(v8::Isolate*, v8::FunctionCallback, v8::Local<v8::Value>, v8::Local<v8::Signature>, int, v8::ConstructorBehavior)
>    static Local<FunctionTemplate> New(
>                                   ^~~
> /usr/include/nodejs/deps/v8/include/v8.h:5445:34: note:   no known conversion for argument 1 from ‘v8::Handle<v8::Value>(const int&) {aka v8::Local<v8::Value>(const int&)}’ to ‘v8::Isolate*’
> ../src/i2c.cc:234:15: error: ‘NewSymbol’ is not a member of ‘v8::String’
>    target->Set(String::NewSymbol("setAddress"),
>                ^~~~~~
> ../src/i2c.cc:235:37: error: no matching function for call to ‘v8::FunctionTemplate::New(v8::Handle<v8::Value> (&)(const int&))’
>      FunctionTemplate::New(SetAddress)->GetFunction());
>                                      ^
> In file included from /usr/include/nodejs/src/node.h:63:0,
>                  from ../src/i2c.cc:1:
> /usr/include/nodejs/deps/v8/include/v8.h:5445:34: note: candidate: static v8::Local<v8::FunctionTemplate> v8::FunctionTemplate::New(v8::Isolate*, v8::FunctionCallback, v8::Local<v8::Value>, v8::Local<v8::Signature>, int, v8::ConstructorBehavior)
>    static Local<FunctionTemplate> New(
>                                   ^~~
> /usr/include/nodejs/deps/v8/include/v8.h:5445:34: note:   no known conversion for argument 1 from ‘v8::Handle<v8::Value>(const int&) {aka v8::Local<v8::Value>(const int&)}’ to ‘v8::Isolate*’
> ../src/i2c.cc:237:15: error: ‘NewSymbol’ is not a member of ‘v8::String’
>    target->Set(String::NewSymbol("open"),
>                ^~~~~~
> ../src/i2c.cc:238:31: error: no matching function for call to ‘v8::FunctionTemplate::New(v8::Handle<v8::Value> (&)(const int&))’
>      FunctionTemplate::New(Open)->GetFunction());
>                                ^
> In file included from /usr/include/nodejs/src/node.h:63:0,
>                  from ../src/i2c.cc:1:
> /usr/include/nodejs/deps/v8/include/v8.h:5445:34: note: candidate: static v8::Local<v8::FunctionTemplate> v8::FunctionTemplate::New(v8::Isolate*, v8::FunctionCallback, v8::Local<v8::Value>, v8::Local<v8::Signature>, int, v8::ConstructorBehavior)
>    static Local<FunctionTemplate> New(
>                                   ^~~
> /usr/include/nodejs/deps/v8/include/v8.h:5445:34: note:   no known conversion for argument 1 from ‘v8::Handle<v8::Value>(const int&) {aka v8::Local<v8::Value>(const int&)}’ to ‘v8::Isolate*’
> ../src/i2c.cc:240:15: error: ‘NewSymbol’ is not a member of ‘v8::String’
>    target->Set(String::NewSymbol("close"),
>                ^~~~~~
> ../src/i2c.cc:241:32: error: no matching function for call to ‘v8::FunctionTemplate::New(v8::Handle<v8::Value> (&)(const int&))’
>      FunctionTemplate::New(Close)->GetFunction());
>                                 ^
> In file included from /usr/include/nodejs/src/node.h:63:0,
>                  from ../src/i2c.cc:1:
> /usr/include/nodejs/deps/v8/include/v8.h:5445:34: note: candidate: static v8::Local<v8::FunctionTemplate> v8::FunctionTemplate::New(v8::Isolate*, v8::FunctionCallback, v8::Local<v8::Value>, v8::Local<v8::Signature>, int, v8::ConstructorBehavior)
>    static Local<FunctionTemplate> New(
>                                   ^~~
> /usr/include/nodejs/deps/v8/include/v8.h:5445:34: note:   no known conversion for argument 1 from ‘v8::Handle<v8::Value>(const int&) {aka v8::Local<v8::Value>(const int&)}’ to ‘v8::Isolate*’
> ../src/i2c.cc:243:15: error: ‘NewSymbol’ is not a member of ‘v8::String’
>    target->Set(String::NewSymbol("writeByte"),
>                ^~~~~~
> ../src/i2c.cc:244:38: error: no matching function for call to ‘v8::FunctionTemplate::New(v8::Handle<v8::Value> (&)(const int&))’
>        FunctionTemplate::New(WriteByte)->GetFunction());
>                                       ^
> In file included from /usr/include/nodejs/src/node.h:63:0,
>                  from ../src/i2c.cc:1:
> /usr/include/nodejs/deps/v8/include/v8.h:5445:34: note: candidate: static v8::Local<v8::FunctionTemplate> v8::FunctionTemplate::New(v8::Isolate*, v8::FunctionCallback, v8::Local<v8::Value>, v8::Local<v8::Signature>, int, v8::ConstructorBehavior)
>    static Local<FunctionTemplate> New(
>                                   ^~~
> /usr/include/nodejs/deps/v8/include/v8.h:5445:34: note:   no known conversion for argument 1 from ‘v8::Handle<v8::Value>(const int&) {aka v8::Local<v8::Value>(const int&)}’ to ‘v8::Isolate*’
> ../src/i2c.cc:246:15: error: ‘NewSymbol’ is not a member of ‘v8::String’
>    target->Set(String::NewSymbol("writeBlock"),
>                ^~~~~~
> ../src/i2c.cc:247:39: error: no matching function for call to ‘v8::FunctionTemplate::New(v8::Handle<v8::Value> (&)(const int&))’
>        FunctionTemplate::New(WriteBlock)->GetFunction());
>                                        ^
> In file included from /usr/include/nodejs/src/node.h:63:0,
>                  from ../src/i2c.cc:1:
> /usr/include/nodejs/deps/v8/include/v8.h:5445:34: note: candidate: static v8::Local<v8::FunctionTemplate> v8::FunctionTemplate::New(v8::Isolate*, v8::FunctionCallback, v8::Local<v8::Value>, v8::Local<v8::Signature>, int, v8::ConstructorBehavior)
>    static Local<FunctionTemplate> New(
>                                   ^~~
> /usr/include/nodejs/deps/v8/include/v8.h:5445:34: note:   no known conversion for argument 1 from ‘v8::Handle<v8::Value>(const int&) {aka v8::Local<v8::Value>(const int&)}’ to ‘v8::Isolate*’
> ../src/i2c.cc:249:15: error: ‘NewSymbol’ is not a member of ‘v8::String’
>    target->Set(String::NewSymbol("readByte"),
>                ^~~~~~
> ../src/i2c.cc:250:35: error: no matching function for call to ‘v8::FunctionTemplate::New(v8::Handle<v8::Value> (&)(const int&))’
>      FunctionTemplate::New(ReadByte)->GetFunction());
>                                    ^
> In file included from /usr/include/nodejs/src/node.h:63:0,
>                  from ../src/i2c.cc:1:
> /usr/include/nodejs/deps/v8/include/v8.h:5445:34: note: candidate: static v8::Local<v8::FunctionTemplate> v8::FunctionTemplate::New(v8::Isolate*, v8::FunctionCallback, v8::Local<v8::Value>, v8::Local<v8::Signature>, int, v8::ConstructorBehavior)
>    static Local<FunctionTemplate> New(
>                                   ^~~
> /usr/include/nodejs/deps/v8/include/v8.h:5445:34: note:   no known conversion for argument 1 from ‘v8::Handle<v8::Value>(const int&) {aka v8::Local<v8::Value>(const int&)}’ to ‘v8::Isolate*’
> ../src/i2c.cc:252:15: error: ‘NewSymbol’ is not a member of ‘v8::String’
>    target->Set(String::NewSymbol("readBlock"),
>                ^~~~~~
> ../src/i2c.cc:253:36: error: no matching function for call to ‘v8::FunctionTemplate::New(v8::Handle<v8::Value> (&)(const int&))’
>      FunctionTemplate::New(ReadBlock)->GetFunction());
>                                     ^
> In file included from /usr/include/nodejs/src/node.h:63:0,
>                  from ../src/i2c.cc:1:
> /usr/include/nodejs/deps/v8/include/v8.h:5445:34: note: candidate: static v8::Local<v8::FunctionTemplate> v8::FunctionTemplate::New(v8::Isolate*, v8::FunctionCallback, v8::Local<v8::Value>, v8::Local<v8::Signature>, int, v8::ConstructorBehavior)
>    static Local<FunctionTemplate> New(
>                                   ^~~
> /usr/include/nodejs/deps/v8/include/v8.h:5445:34: note:   no known conversion for argument 1 from ‘v8::Handle<v8::Value>(const int&) {aka v8::Local<v8::Value>(const int&)}’ to ‘v8::Isolate*’
> i2c.target.mk:91: 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/node-red-contrib-mcp23017/node_modules/node-mcp23017/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/share/node-gyp/lib/build.js:276:23)
> gyp ERR! stack     at emitTwo (events.js:126:13)
> gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
> gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
> gyp ERR! System Linux 4.14.79-v7+
> gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "rebuild"
> gyp ERR! cwd /home/pi/.node-red/node_modules/node-red-contrib-mcp23017/node_modules/node-mcp23017/node_modules/i2c
> gyp ERR! node -v v8.11.1
> gyp ERR! node-gyp -v v3.4.0
> gyp ERR! not ok 
> npm WARN This failure might be due to the use of legacy binary "node"
> npm WARN For further explanations, please read
> /usr/share/doc/nodejs/README.Debian
>  
> npm ERR! i2c@0.1.4 install: `node-gyp rebuild`
> npm ERR! Exit status 1
> npm ERR! 
> npm ERR! Failed at the i2c@0.1.4 install script.
> npm ERR! This is most likely a problem with the i2c package,
> npm ERR! not with npm itself.
> npm ERR! Tell the author that this fails on your system:
> npm ERR!     node-gyp rebuild
> npm ERR! You can get their info via:
> npm ERR!     npm owner ls i2c
> npm ERR! There is likely additional logging output above.
> 
> npm ERR! System Linux 4.14.79-v7+
> npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "node-red-contrib-mcp23017"
> npm ERR! cwd /home/pi/.node-red
> npm ERR! node -v v8.11.1
> npm ERR! npm -v 1.4.21
> npm ERR! code ELIFECYCLE
> npm ERR! 
> npm ERR! Additional logging details can be found in:
> npm ERR!     /home/pi/.node-red/npm-debug.log
> npm ERR! not ok code 0
> pi@raspberrypi:~/.node-red $ 

What operating system are you doing this on? Is it a "lite" version?

Could you try installing the following

sudo apt-get install build-essential

and then retry

Raspbian V12.3

Did you follow the instructions in the README at https://github.com/kaihenzler/node-mcp23017 and install that node?

Hello,

I have installed it, or tried to install it, and the folders shown in the screenshot have been added. I think I did something wrong here and the errors come from it.

Does someone have experience with adding this node and usage of the MCP23017 IC with Nod-Red?, or can someone explain/try how to install it? I saw on other websites that more people were having problems installing this node.

You have installed it in the wrong place. When you install nodes from the command line you should first go to the .node-red folder.

cd .node-red
npm install ......

[Edit]
Or if you are not in the users home folder then

cd ~/.node-red
npm install .....

Are you doing this on a Pi?

Did you follow the node-mcp23017 README and

  • change the /etc/modules
  • Load kernel module
  • Make device writable
    ??

How can I save the added data in these 2 commands?

Add these two lines
i2c-bcm2708
i2c-dev

$ sudo vi /etc/modprobe.d/raspi-blacklist.conf

Comment out blacklist i2c-bcm2708

#blacklist i2c-bcm2708

I am having problems setting up pins as inputs on a 32 chan board. At first I could only get the first 8. Then I found this thread and went through all off the above. Now I can get all 16 on chip one (addressed 0x20). I am not able to get any of the inputs to recognize/see state change from chip 2 (addressed 0x22). Is there some special trick I am missing?
Chip 1

When I run d i2cdetect -y 1 it only shows 0x20. Both chips are on the same board.

image

What steps am I missing?