Node-RED on Pi 3 to use GPIO and serial/modbus

Hi all,

Very new to BalenaOS. Have set up a Pi 3 with the balena-node-red docker container and got this setup, so I can deploy basic node-red flows. Despite this, I’ve been unable to access any GPIO (Node-RED says Pi.GPIO lib is missing on boot and I can’t install via pip for some reason) and I’ve tried installing various other modbus palettes for Node-RED with no luck (lots of missing dependencies, mainly serial).

I’m more than happy to press on with this method of running Node-RED on a Balena OS Pi 3, however am just intrigued to see how other people have done this.

Thanks,
Joe

BTW I’ve been using this modified dockerfile which has helped greatly with using GPIO: https://github.com/balena-io-projects/balena-node-red/pull/15

Thanks @kanr

@kanr- thanks for the offer of help over on GitHub (via issue #14)

I’m trying to setup the modbus node but not having any joy. Stack trace below - any ideas?

18.11.18 11:24:44 (+0000)  main  18 Nov 11:24:44 - [info] Installing module: node-red-contrib-modbus, version: 4.1.1
18.11.18 11:26:51 (+0000)  main  18 Nov 11:26:51 - [warn] Installation of module node-red-contrib-modbus failed:
18.11.18 11:26:51 (+0000)  main  18 Nov 11:26:51 - [warn] ------------------------------------------
18.11.18 11:26:51 (+0000)  main  18 Nov 11:26:51 - [warn]
18.11.18 11:26:51 (+0000)  main  > @serialport/bindings@2.0.2 install /data/node-red/user/node_modules/@serialport/bindings
18.11.18 11:26:51 (+0000)  main  > prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild
18.11.18 11:26:51 (+0000)  main
18.11.18 11:26:51 (+0000)  main  prebuild-install WARN install No prebuilt binaries found (target=6.14.4 runtime=node arch=arm platform=linux)
18.11.18 11:26:51 (+0000)  main  make: Entering directory '/data/node-red/user/node_modules/@serialport/bindings/build'
18.11.18 11:26:51 (+0000)  main    CXX(target) Release/obj.target/bindings/src/serialport.o
18.11.18 11:26:51 (+0000)  main  ../src/serialport.cpp: In function 'void EIO_AfterOpen(uv_work_t*)':
18.11.18 11:26:51 (+0000)  main  ../src/serialport.cpp:95:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
18.11.18 11:26:51 (+0000)  main     data->callback.Call(2, argv);
18.11.18 11:26:51 (+0000)  main                                ^
18.11.18 11:26:51 (+0000)  main  In file included from ../src/./serialport.h:6:0,
18.11.18 11:26:51 (+0000)  main                   from ../src/serialport.cpp:1:
18.11.18 11:26:51 (+0000)  main  ../../../nan/nan.h:1655:3: note: declared here
18.11.18 11:26:51 (+0000)  main     Call(int argc, v8::Local<v8::Value> argv[]) const {
18.11.18 11:26:51 (+0000)  main     ^~~~
18.11.18 11:26:51 (+0000)  main  ../src/serialport.cpp: In function 'void EIO_AfterUpdate(uv_work_t*)':
18.11.18 11:26:51 (+0000)  main  ../src/serialport.cpp:150:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
18.11.18 11:26:51 (+0000)  main     data->callback.Call(1, argv);
18.11.18 11:26:51 (+0000)  main                                ^
18.11.18 11:26:51 (+0000)  main  In file included from ../src/./serialport.h:6:0,
18.11.18 11:26:51 (+0000)  main                   from ../src/serialport.cpp:1:
18.11.18 11:26:51 (+0000)  main  ../../../nan/nan.h:1655:3: note: declared here
18.11.18 11:26:51 (+0000)  main     Call(int argc, v8::Local<v8::Value> argv[]) const {
18.11.18 11:26:51 (+0000)  main     ^~~~
18.11.18 11:26:51 (+0000)  main  ../src/serialport.cpp: In function 'void EIO_AfterClose(uv_work_t*)':
18.11.18 11:26:51 (+0000)  main  ../src/serialport.cpp:188:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
18.11.18 11:26:51 (+0000)  main     data->callback.Call(1, argv);
18.11.18 11:26:51 (+0000)  main                                ^
18.11.18 11:26:51 (+0000)  main  In file included from ../src/./serialport.h:6:0,
18.11.18 11:26:51 (+0000)  main                   from ../src/serialport.cpp:1:
18.11.18 11:26:51 (+0000)  main  ../../../nan/nan.h:1655:3: note: declared here
18.11.18 11:26:51 (+0000)  main     Call(int argc, v8::Local<v8::Value> argv[]) const {
18.11.18 11:26:51 (+0000)  main     ^~~~
18.11.18 11:26:51 (+0000)  main  ../src/serialport.cpp: In function 'void EIO_AfterFlush(uv_work_t*)':
18.11.18 11:26:51 (+0000)  main  ../src/serialport.cpp:231:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
18.11.18 11:26:51 (+0000)  main     data->callback.Call(1, argv);
18.11.18 11:26:51 (+0000)  main                                ^
18.11.18 11:26:51 (+0000)  main  In file included from ../src/./serialport.h:6:0,
18.11.18 11:26:51 (+0000)  main                   from ../src/serialport.cpp:1:
18.11.18 11:26:51 (+0000)  main  ../../../nan/nan.h:1655:3: note: declared here
18.11.18 11:26:51 (+0000)  main     Call(int argc, v8::Local<v8::Value> argv[]) const {
18.11.18 11:26:51 (+0000)  main     ^~~~
18.11.18 11:26:51 (+0000)  main  ../src/serialport.cpp: In function 'void EIO_AfterSet(uv_work_t*)':
18.11.18 11:26:51 (+0000)  main  ../src/serialport.cpp:285:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
18.11.18 11:26:51 (+0000)  main     data->callback.Call(1, argv);
18.11.18 11:26:51 (+0000)  main                                ^
18.11.18 11:26:51 (+0000)  main  In file included from ../src/./serialport.h:6:0,
18.11.18 11:26:51 (+0000)  main                   from ../src/serialport.cpp:1:
18.11.18 11:26:51 (+0000)  main  ../../../nan/nan.h:1655:3: note: declared here
18.11.18 11:26:51 (+0000)  main     Call(int argc, v8::Local<v8::Value> argv[]) const {
18.11.18 11:26:51 (+0000)  main     ^~~~
18.11.18 11:26:51 (+0000)  main  ../src/serialport.cpp: In function 'void EIO_AfterGet(uv_work_t*)':
18.11.18 11:26:51 (+0000)  main  ../src/serialport.cpp:336:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
18.11.18 11:26:51 (+0000)  main     data->callback.Call(2, argv);
18.11.18 11:26:51 (+0000)  main                                ^
18.11.18 11:26:51 (+0000)  main  In file included from ../src/./serialport.h:6:0,
18.11.18 11:26:51 (+0000)  main                   from ../src/serialport.cpp:1:
18.11.18 11:26:51 (+0000)  main  ../../../nan/nan.h:1655:3: note: declared here
18.11.18 11:26:51 (+0000)  main     Call(int argc, v8::Local<v8::Value> argv[]) const {
18.11.18 11:26:51 (+0000)  main     ^~~~
18.11.18 11:26:51 (+0000)  main  ../src/serialport.cpp: In function 'void EIO_AfterGetBaudRate(uv_work_t*)':
18.11.18 11:26:51 (+0000)  main  ../src/serialport.cpp:383:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
18.11.18 11:26:51 (+0000)  main     data->callback.Call(2, argv);
18.11.18 11:26:51 (+0000)  main                                ^
18.11.18 11:26:51 (+0000)  main  In file included from ../src/./serialport.h:6:0,
18.11.18 11:26:51 (+0000)  main                   from ../src/serialport.cpp:1:
18.11.18 11:26:51 (+0000)  main  ../../../nan/nan.h:1655:3: note: declared here
18.11.18 11:26:51 (+0000)  main     Call(int argc, v8::Local<v8::Value> argv[]) const {
18.11.18 11:26:51 (+0000)  main     ^~~~
18.11.18 11:26:51 (+0000)  main  ../src/serialport.cpp: In function 'void EIO_AfterDrain(uv_work_t*)':
18.11.18 11:26:51 (+0000)  main  ../src/serialport.cpp:424:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
18.11.18 11:26:51 (+0000)  main     data->callback.Call(1, argv);
18.11.18 11:26:51 (+0000)  main                                ^
18.11.18 11:26:51 (+0000)  main  In file included from ../src/./serialport.h:6:0,
18.11.18 11:26:51 (+0000)  main                   from ../src/serialport.cpp:1:
18.11.18 11:26:51 (+0000)  main  ../../../nan/nan.h:1655:3: note: declared here
18.11.18 11:26:51 (+0000)  main     Call(int argc, v8::Local<v8::Value> argv[]) const {
18.11.18 11:26:51 (+0000)  main     ^~~~
18.11.18 11:26:51 (+0000)  main    CXX(target) Release/obj.target/bindings/src/serialport_unix.o
18.11.18 11:26:51 (+0000)  main  ../src/serialport_unix.cpp:24:26: fatal error: linux/serial.h: No such file or directory
18.11.18 11:26:51 (+0000)  main   #include <linux/serial.h>
18.11.18 11:26:51 (+0000)  main                            ^
18.11.18 11:26:51 (+0000)  main  compilation terminated.
18.11.18 11:26:51 (+0000)  main  make: *** [bindings.target.mk:95: Release/obj.target/bindings/src/serialport_unix.o] Error 1
18.11.18 11:26:51 (+0000)  main  make: Leaving directory '/data/node-red/user/node_modules/@serialport/bindings/build'
18.11.18 11:26:51 (+0000)  main  gyp ERR! build error
18.11.18 11:26:51 (+0000)  main  gyp ERR! stack Error: `make` failed with exit code: 2
18.11.18 11:26:51 (+0000)  main  gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
18.11.18 11:26:57 (+0000) Warning: Suppressed 13 message(s) due to slow reading
18.11.18 11:26:51 (+0000)  main  prebuild-install WARN install No prebuilt binaries found (target=6.14.4 runtime=node arch=arm platform=linux)
18.11.18 11:26:51 (+0000)  main  make: Entering directory '/data/node-red/user/node_modules/modbus-serial/node_modules/serialport/build'
18.11.18 11:26:51 (+0000)  main    CXX(target) Release/obj.target/serialport/src/serialport.o
18.11.18 11:26:51 (+0000)  main  ../src/serialport.cpp: In function 'void EIO_AfterOpen(uv_work_t*)':
18.11.18 11:26:51 (+0000)  main  ../src/serialport.cpp:95:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
18.11.18 11:26:51 (+0000)  main     data->callback.Call(2, argv);
18.11.18 11:26:51 (+0000)  main                                ^
18.11.18 11:26:51 (+0000)  main  In file included from ../src/./serialport.h:6:0,
18.11.18 11:26:51 (+0000)  main                   from ../src/serialport.cpp:1:
18.11.18 11:26:51 (+0000)  main  ../../../../nan/nan.h:1655:3: note: declared here
18.11.18 11:26:51 (+0000)  main     Call(int argc, v8::Local<v8::Value> argv[]) const {
18.11.18 11:26:51 (+0000)  main     ^~~~
18.11.18 11:26:51 (+0000)  main  ../src/serialport.cpp: In function 'void EIO_AfterUpdate(uv_work_t*)':
18.11.18 11:26:51 (+0000)  main  ../src/serialport.cpp:150:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
18.11.18 11:26:51 (+0000)  main     data->callback.Call(1, argv);
18.11.18 11:26:51 (+0000)  main                                ^
18.11.18 11:26:51 (+0000)  main  In file included from ../src/./serialport.h:6:0,
18.11.18 11:26:51 (+0000)  main                   from ../src/serialport.cpp:1:
18.11.18 11:26:51 (+0000)  main  ../../../../nan/nan.h:1655:3: note: declared here
18.11.18 11:26:51 (+0000)  main     Call(int argc, v8::Local<v8::Value> argv[]) const {
18.11.18 11:26:51 (+0000)  main     ^~~~
18.11.18 11:26:51 (+0000)  main  ../src/serialport.cpp: In function 'void EIO_AfterClose(uv_work_t*)':
18.11.18 11:26:51 (+0000)  main  ../src/serialport.cpp:188:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
18.11.18 11:26:51 (+0000)  main     data->callback.Call(1, argv);
18.11.18 11:26:51 (+0000)  main                                ^
18.11.18 11:26:51 (+0000)  main  In file included from ../src/./serialport.h:6:0,
18.11.18 11:26:51 (+0000)  main                   from ../src/serialport.cpp:1:
18.11.18 11:26:51 (+0000)  main  ../../../../nan/nan.h:1655:3: note: declared here
18.11.18 11:26:51 (+0000)  main     Call(int argc, v8::Local<v8::Value> argv[]) const {
18.11.18 11:26:51 (+0000)  main     ^~~~
18.11.18 11:26:51 (+0000)  main  ../src/serialport.cpp: In function 'void EIO_AfterFlush(uv_work_t*)':
18.11.18 11:26:51 (+0000)  main  ../src/serialport.cpp:231:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
18.11.18 11:26:51 (+0000)  main     data->callback.Call(1, argv);
18.11.18 11:26:51 (+0000)  main                                ^
18.11.18 11:26:51 (+0000)  main  In file included from ../src/./serialport.h:6:0,
18.11.18 11:26:51 (+0000)  main                   from ../src/serialport.cpp:1:
18.11.18 11:26:51 (+0000)  main  ../../../../nan/nan.h:1655:3: note: declared here
18.11.18 11:26:51 (+0000)  main     Call(int argc, v8::Local<v8::Value> argv[]) const {
18.11.18 11:26:51 (+0000)  main     ^~~~
18.11.18 11:26:51 (+0000)  main  ../src/serialport.cpp: In function 'void EIO_AfterSet(uv_work_t*)':
18.11.18 11:26:51 (+0000)  main  ../src/serialport.cpp:285:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
18.11.18 11:26:51 (+0000)  main     data->callback.Call(1, argv);
18.11.18 11:26:51 (+0000)  main                                ^
18.11.18 11:26:51 (+0000)  main  In file included from ../src/./serialport.h:6:0,
18.11.18 11:26:51 (+0000)  main                   from ../src/serialport.cpp:1:
18.11.18 11:26:51 (+0000)  main  ../../../../nan/nan.h:1655:3: note: declared here
18.11.18 11:26:51 (+0000)  main     Call(int argc, v8::Local<v8::Value> argv[]) const {
18.11.18 11:26:51 (+0000)  main     ^~~~
18.11.18 11:26:51 (+0000)  main  ../src/serialport.cpp: In function 'void EIO_AfterGet(uv_work_t*)':
18.11.18 11:26:51 (+0000)  main  ../src/serialport.cpp:336:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
18.11.18 11:26:51 (+0000)  main     data->callback.Call(2, argv);
18.11.18 11:26:51 (+0000)  main                                ^
18.11.18 11:26:51 (+0000)  main  In file included from ../src/./serialport.h:6:0,
18.11.18 11:26:51 (+0000)  main                   from ../src/serialport.cpp:1:
18.11.18 11:26:51 (+0000)  main  ../../../../nan/nan.h:1655:3: note: declared here
18.11.18 11:26:51 (+0000)  main     Call(int argc, v8::Local<v8::Value> argv[]) const {
18.11.18 11:26:51 (+0000)  main     ^~~~
18.11.18 11:26:51 (+0000)  main  ../src/serialport.cpp: In function 'void EIO_AfterGetBaudRate(uv_work_t*)':
18.11.18 11:26:51 (+0000)  main  ../src/serialport.cpp:383:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
18.11.18 11:26:51 (+0000)  main     data->callback.Call(2, argv);
18.11.18 11:26:51 (+0000)  main                                ^
18.11.18 11:26:51 (+0000)  main  In file included from ../src/./serialport.h:6:0,
18.11.18 11:26:51 (+0000)  main                   from ../src/serialport.cpp:1:
18.11.18 11:26:51 (+0000)  main  ../../../../nan/nan.h:1655:3: note: declared here
18.11.18 11:26:51 (+0000)  main     Call(int argc, v8::Local<v8::Value> argv[]) const {
18.11.18 11:26:51 (+0000)  main     ^~~~
18.11.18 11:26:51 (+0000)  main  ../src/serialport.cpp: In function 'void EIO_AfterDrain(uv_work_t*)':
18.11.18 11:26:51 (+0000)  main  ../src/serialport.cpp:424:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
18.11.18 11:26:51 (+0000)  main     data->callback.Call(1, argv);
18.11.18 11:26:51 (+0000)  main                                ^
18.11.18 11:26:51 (+0000)  main  In file included from ../src/./serialport.h:6:0,
18.11.18 11:26:51 (+0000)  main                   from ../src/serialport.cpp:1:
18.11.18 11:26:51 (+0000)  main  ../../../../nan/nan.h:1655:3: note: declared here
18.11.18 11:26:51 (+0000)  main     Call(int argc, v8::Local<v8::Value> argv[]) const {
18.11.18 11:26:51 (+0000)  main     ^~~~
18.11.18 11:26:51 (+0000)  main    CXX(target) Release/obj.target/serialport/src/serialport_unix.o
18.11.18 11:26:51 (+0000)  main  ../src/serialport_unix.cpp:24:26: fatal error: linux/serial.h: No such file or directory
18.11.18 11:26:51 (+0000)  main   #include <linux/serial.h>
18.11.18 11:26:51 (+0000)  main                            ^
18.11.18 11:26:51 (+0000)  main  compilation terminated.
18.11.18 11:26:51 (+0000)  main  make: *** [serialport.target.mk:95: Release/obj.target/serialport/src/serialport_unix.o] Error 1
18.11.18 11:26:51 (+0000)  main  make: Leaving directory '/data/node-red/user/node_modules/modbus-serial/node_modules/serialport/build'
18.11.18 11:26:51 (+0000)  main  gyp ERR! build error
18.11.18 11:26:51 (+0000)  main  gyp ERR! stack Error: `make` failed with exit code: 2
18.11.18 11:26:51 (+0000)  main  gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
18.11.18 11:26:51 (+0000)  main  gyp ERR! stack     at emitTwo (events.js:106:13)
18.11.18 11:26:51 (+0000)  main  gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
18.11.18 11:26:51 (+0000)  main  gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:219:12)
18.11.18 11:26:51 (+0000)  main  gyp ERR! System Linux 4.14.68
18.11.18 11:26:51 (+0000)  main  gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"

I think the issue might be in serialport which is a dependency of node-red-contrib-modbus. Its possible it’s not getting installed so you might try adding it to the Dockerfile before node-red-contrib-modbus.

If your dockerfile is public I can take a look.

I will tell you what else I did, i commented out the apk del.... g++, python in all my builds, which just makes them a little larger. Some dependencies may use python or c++ such as serialport for installation or at runtime.

I have been curious where I might find a MODBUS port to test against, I love testing all the things I can talk to from node red. I am seeing a couple things like https://www.amazon.com/EPEVER-Controller-Tracer1210A-Regulator-Display/dp/B0734TP9W2/ref=sr_1_34?ie=UTF8&qid=1542613853&sr=8-34&keywords=modbus,

Where else do we commonly find modbus?

@kanr I copied your makefile from PR 14 and also removed the apk del line to keep python in place.

I’ll try adding npm install serialport to my dockerfile and see how far I get.

In terms of really cheap modbus devices to test with, you can use an SDM120 energy meter which is well documented online and in forums. Modbus is generally a great communication protocol - one of my favourites!

Most USB - RS485 converters for the Pi work well, as well as the hats.

@kanr As suspected (I think I tried this on Saturday but didn’t document), adding npm install serialport after the installation of RPi.GPIO in the dockerfile caused a whole load of errors.

I think it’s an incompatibility issue: No prebuilt binaries found (target=6.14.4 runtime=node arch=arm platform=linux).

It looks like maybe though serialport isn’t supported. Look at the npm page - ¹ ARM, MIPSel and PPC64¹ platforms are not currently part of our testing or build matrix, but will probably work.

I’m going to keep digging.

UPDATE - I have tried to install serialport with --unsafe-perm --build-from-source but still no joy.

Logs for reference:

[main]     > @serialport/bindings@2.0.2 install /usr/src/app/node_modules/@serialport/bindings
[main]     > prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild
[main]     prebuild-install WARN 
[main]     install
[main]      No prebuilt binaries found (target=6.14.4 runtime=node arch=arm platform=linux)
[main]     
[main]     make: Entering directory '/usr/src/app/node_modules/@serialport/bindings/build'
[main]       CXX(target) Release/obj.target/bindings/src/serialport.o
[main]     ../src/serialport.cpp: In function 'void EIO_AfterOpen(uv_work_t*)':
[main]     ../src/serialport.cpp:95:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
[main]        data->callback.Call(2, argv);
[main]                                   ^
[main]     In file included from ../src/./serialport.h:6:0,
[main]                      from ../src/serialport.cpp:1:
[main]     ../../../nan/nan.h:1655:3: note: declared here
[main]        Call(int argc, v8::Local<v8::Value> argv[]) const {
[main]        ^~~~
[main]     
[main]     ../src/serialport.cpp: In function 'void EIO_AfterUpdate(uv_work_t*)':
[main]     ../src/serialport.cpp:150:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
[main]        data->callback.Call(1, argv);
[main]                                   ^
[main]     In file included from ../src/./serialport.h:6:0,
[main]                      from ../src/serialport.cpp:1:
[main]     ../../../nan/nan.h:1655:3: note: declared here
[main]        Call(int argc, v8::Local<v8::Value> argv[]) const {
[main]        ^~~~
[main]     
[main]     ../src/serialport.cpp: In function 'void EIO_AfterClose(uv_work_t*)':
[main]     ../src/serialport.cpp:188:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
[main]        data->callback.Call(1, argv);
[main]                                   ^
[main]     In file included from ../src/./serialport.h:6:0,
[main]                      from ../src/serialport.cpp:1:
[main]     ../../../nan/nan.h:1655:3: note: declared here
[main]        Call(int argc, v8::Local<v8::Value> argv[]) const {
[main]        ^~~~
[main]     
[main]     ../src/serialport.cpp: In function 'void EIO_AfterFlush(uv_work_t*)':
[main]     ../src/serialport.cpp:231:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
[main]        data->callback.Call(1, argv);
[main]                                   ^
[main]     In file included from ../src/./serialport.h:6:0,
[main]                      from ../src/serialport.cpp:1:
[main]     ../../../nan/nan.h:1655:3: note: declared here
[main]        Call(int argc, v8::Local<v8::Value> argv[]) const {
[main]        ^~~~
[main]     
[main]     ../src/serialport.cpp: In function 'void EIO_AfterSet(uv_work_t*)':
[main]     ../src/serialport.cpp:285:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
[main]        data->callback.Call(1, argv);
[main]                                   ^
[main]     In file included from ../src/./serialport.h:6:0,
[main]                      from ../src/serialport.cpp:1:
[main]     ../../../nan/nan.h:1655:3: note: declared here
[main]        Call(int argc, v8::Local<v8::Value> argv[]) const {
[main]        ^~~~
[main]     
[main]     ../src/serialport.cpp: In function 'void EIO_AfterGet(uv_work_t*)':
[main]     ../src/serialport.cpp:336:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
[main]        data->callback.Call(2, argv);
[main]                                   ^
[main]     In file included from ../src/./serialport.h:6:0,
[main]                      from ../src/serialport.cpp:1:
[main]     ../../../nan/nan.h:1655:3: note: declared here
[main]        Call(int argc, v8::Local<v8::Value> argv[]) const {
[main]        ^~~~
[main]     
[main]     ../src/serialport.cpp: In function 'void EIO_AfterGetBaudRate(uv_work_t*)':
[main]     ../src/serialport.cpp:383:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
[main]        data->callback.Call(2, argv);
[main]                                   ^
[main]     In file included from ../src/./serialport.h:6:0,
[main]                      from ../src/serialport.cpp:1:
[main]     ../../../nan/nan.h:1655:3: note: declared here
[main]        Call(int argc, v8::Local<v8::Value> argv[]) const {
[main]        ^~~~
[main]     
[main]     ../src/serialport.cpp: In function 'void EIO_AfterDrain(uv_work_t*)':
[main]     ../src/serialport.cpp:424:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
[main]        data->callback.Call(1, argv);
[main]                                   ^
[main]     In file included from ../src/./serialport.h:6:0,
[main]                      from ../src/serialport.cpp:1:
[main]     ../../../nan/nan.h:1655:3: note: declared here
[main]        Call(int argc, v8::Local<v8::Value> argv[]) const {
[main]        ^~~~
[main]     
[main]       CXX(target) Release/obj.target/bindings/src/serialport_unix.o
[main]     ../src/serialport_unix.cpp:24:26: fatal error: linux/serial.h: No such file or directory
[main]      #include <linux/serial.h>
[main]                               ^
[main]     compilation terminated.
[main]     
[main]     make: *** [bindings.target.mk:95: Release/obj.target/bindings/src/serialport_unix.o] Error 1
[main]     
[main]     make: Leaving directory '/usr/src/app/node_modules/@serialport/bindings/build'
[main]     gyp
[main]      
[main]     ERR! build error
[main]     
[main]     
[main]     gyp ERR! 
[main]     stack Error: `make` failed with exit code: 2
[main]     gyp 
[main]     ERR! 
[main]     stack
[main]          at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
[main]     gyp ERR! 
[main]     stack     at emitTwo (events.js:106:13)
[main]     
[main]     gyp
[main]      ERR! 
[main]     stack     at ChildProcess.emit (events.js:191:7)
[main]     gyp 
[main]     ERR!
[main]      
[main]     stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:219:12)
[main]     
[main]     gyp ERR!
[main]      System Linux 4.15.0-34-generic
[main]     
[main]     gyp ERR! 
[main]     command
[main]      "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
[main]     gyp
[main]      ERR!
[main]      cwd /usr/src/app/node_modules/@serialport/bindings
[main]     
[main]     gyp ERR! node -v
[main]      v6.14.4
[main]     
[main]     gyp ERR! node-gyp -v
[main]      v3.4.0
[main]     gyp
[main]      ERR! 
[main]     not ok
[main]     
[main]     /usr/src/app
[main]     +-- @serialport/parser-byte-length@2.0.1
[main]     +-- @serialport/parser-cctalk@2.0.1
[main]     +-- @serialport/parser-readline@2.0.1
[main]     | `-- @serialport/parser-delimiter@2.0.1
[main]     +-- @serialport/parser-ready@2.0.1
[main]     +-- @serialport/parser-regex@2.0.1
[main]     +-- @serialport/stream@2.0.1
[main]     | +-- @serialport/binding-mock@2.0.1
[main]     | | `-- @serialport/binding-abstract@2.0.1
[main]     | `-- debug@3.2.6
[main]     |   `-- ms@2.1.1
[main]     +-- commander@2.19.0
[main]     +-- promirepl@1.0.1
[main]     `-- prompt-list@3.2.0
[main]       +-- ansi-cyan@0.1.1
[main]       | `-- ansi-wrap@0.1.0
[main]       +-- ansi-dim@0.1.1
[main]       `-- prompt-radio@1.2.1
[main]         +-- debug@2.6.9
[main]         | `-- ms@2.0.0
[main]         `-- prompt-checkbox@2.2.0
[main]           +-- debug@2.6.9
[main]           | `-- ms@2.0.0
[main]           `-- prompt-base@4.1.0
[main]             +-- component-emitter@1.2.1
[main]             +-- koalas@1.0.2
[main]             +-- log-utils@0.2.1
[main]             | +-- ansi-colors@0.2.0
[main]             | | +-- ansi-bgblack@0.1.1
[main]             | | +-- ansi-bgblue@0.1.1
[main]             | | +-- ansi-bgcyan@0.1.1
[main]             | | +-- ansi-bggreen@0.1.1
[main]             | | +-- ansi-bgmagenta@0.1.1
[main]             | | +-- ansi-bgred@0.1.1
[main]             | | +-- ansi-bgwhite@0.1.1
[main]             | | +-- ansi-bgyellow@0.1.1
[main]             | | +-- ansi-black@0.1.1
[main]             | | +-- ansi-blue@0.1.1
[main]             | | +-- ansi-bold@0.1.1
[main]             | | +-- ansi-gray@0.1.1
[main]             | | +-- ansi-green@0.1.1
[main]             | | +-- ansi-grey@0.1.1
[main]             | | +-- ansi-hidden@0.1.1
[main]             | | +-- ansi-inverse@0.1.1
[main]             | | +-- ansi-italic@0.1.1
[main]             | | +-- ansi-magenta@0.1.1
[main]             | | +-- ansi-red@0.1.1
[main]             | | +-- ansi-reset@0.1.1
[main]             | | +-- ansi-strikethrough@0.1.1
[main]             | | +-- ansi-underline@0.1.1
[main]             | | +-- ansi-white@0.1.1
[main]             | | +-- ansi-yellow@0.1.1
[main]             | | `-- lazy-cache@2.0.2
[main]             | |   `-- set-getter@0.1.0
[main]             | |     `-- to-object-path@0.3.0
[main]             | +-- error-symbol@0.1.0
[main]             | +-- info-symbol@0.1.0
[main]             | +-- log-ok@0.1.1
[main]             | +-- success-symbol@0.1.0
[main]             | +-- time-stamp@1.1.0
[main]             | `-- warning-symbol@0.1.0
[main]             +-- prompt-actions@3.0.2
[main]             | `-- debug@2.6.9
[main]             |   `-- ms@2.0.0
[main]             +-- prompt-question@5.0.2
[main]             | +-- clone-deep@1.0.0
[main]             | | +-- for-own@1.0.0
[main]             | | | `-- for-in@1.0.2
[main]             | | +-- is-plain-object@2.0.4
[main]             | | +-- kind-of@5.1.0
[main]             | | `-- shallow-clone@1.0.0
[main]             | |   +-- kind-of@5.1.0
[main]             | |   `-- mixin-object@2.0.1
[main]             | |     `-- for-in@0.1.8
[main]             | +-- define-property@1.0.0
[main]             | | `-- is-descriptor@1.0.2
[main]             | |   +-- is-accessor-descriptor@1.0.0
[main]             | |   | `-- kind-of@6.0.2
[main]             | |   +-- is-data-descriptor@1.0.0
[main]             | |   | `-- kind-of@6.0.2
[main]             | |   `-- kind-of@6.0.2
[main]             | +-- isobject@3.0.1
[main]             | +-- kind-of@5.1.0
[main]             | `-- prompt-choices@4.1.0
[main]             |   +-- arr-swap@1.0.1
[main]             |   | `-- is-number@3.0.0
[main]             |   +-- choices-separator@2.0.0
[main]             |   | `-- debug@2.6.9
[main]             |   |   `-- ms@2.0.0
[main]             |   +-- clone-deep@4.0.0
[main]             |   | `-- shallow-clone@3.0.0
[main]             |   +-- collection-visit@1.0.0
[main]             |   | +-- map-visit@1.0.0
[main]             |   | `-- object-visit@1.0.1
[main]             |   +-- define-property@2.0.2
[main]             |   +-- is-number@6.0.0
[main]             |   +-- kind-of@6.0.2
[main]             |   +-- pointer-symbol@1.0.0
[main]             |   +-- radio-symbol@2.0.0
[main]             |   +-- set-value@3.0.0
[main]             |   +-- terminal-paginator@2.0.2
[main]             |   | `-- debug@2.6.9
[main]             |   |   `-- ms@2.0.0
[main]             |   `-- toggle-array@1.0.1
[main]             +-- readline-ui@2.2.3
[main]             | +-- debug@2.6.9
[main]             | | `-- ms@2.0.0
[main]             | `-- string-width@2.1.1
[main]             |   +-- is-fullwidth-code-point@2.0.0
[main]             |   `-- strip-ansi@4.0.0
[main]             |     `-- ansi-regex@3.0.0
[main]             +-- readline-utils@2.2.3
[main]             | +-- arr-flatten@1.1.0
[main]             | +-- extend-shallow@2.0.1
[main]             | | `-- is-extendable@0.1.1
[main]             | +-- is-buffer@1.1.6
[main]             | +-- is-number@3.0.0
[main]             | | `-- kind-of@3.2.2
[main]             | +-- is-windows@1.0.2
[main]             | +-- mute-stream@0.0.7
[main]             | +-- strip-color@0.1.0
[main]             | `-- window-size@1.1.1
[main]             |   `-- is-number@3.0.0
[main]             `-- static-extend@0.1.2
[main]               +-- define-property@0.2.5
[main]               | `-- is-descriptor@0.1.6
[main]               |   +-- is-accessor-descriptor@0.1.6
[main]               |   | `-- kind-of@3.2.2
[main]               |   +-- is-data-descriptor@0.1.4
[main]               |   | `-- kind-of@3.2.2
[main]               |   `-- kind-of@5.1.0
[main]               `-- object-copy@0.1.0
[main]                 +-- copy-descriptor@0.1.1
[main]                 `-- define-property@0.2.5
[main]                   `-- is-descriptor@0.1.6
[main]                     +-- is-accessor-descriptor@0.1.6
[main]                     +-- is-data-descriptor@0.1.4
[main]                     `-- kind-of@5.1.0
[main]     npm WARN enoent
[main]      ENOENT: no such file or directory, open '/usr/src/app/package.json'
[main]     
[main]     npm WARN app No description
[main]     
[main]     npm 
[main]     WARN
[main]      app No repository field.
[main]     
[main]     npm WARN
[main]      app No README data
[main]     
[main]     npm WARN app No license field.
[main]     
[main]     npm ERR! Linux 4.15.0-34-generic
[main]     
[main]     npm ERR! argv
[main]      "/usr/local/bin/node" "/usr/local/bin/npm" "install" "serialport"
[main]     
[main]     npm
[main]      
[main]     ERR! 
[main]     node v6.14.4
[main]     
[main]     npm ERR! npm  v3.10.10
[main]     
[main]     npm ERR!
[main]      code ELIFECYCLE
[main]     
[main]     
[main]     
[main]     npm ERR! @serialport/bindings@2.0.2 install: `prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild`
[main]     
[main]     npm 
[main]     ERR! Exit status 1
[main]     
[main]     npm
[main]      
[main]     ERR!
[main]     
[main]     
[main]     npm
[main]      ERR!
[main]      Failed at the @serialport/bindings@2.0.2 install script 'prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild'.
[main]     npm ERR!
[main]      Make sure you have the latest version of node.js and npm installed.
[main]     npm
[main]      ERR!
[main]      If you do, this is most likely a problem with the @serialport/bindings package,
[main]     
[main]     npm
[main]      ERR!
[main]      not with npm itself.
[main]     npm 
[main]     ERR! Tell the author that this fails on your system:
[main]     npm 
[main]     ERR!
[main]          prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild
[main]     npm ERR! You can get information on how to open an issue for this project with:
[main]     
[main]     npm
[main]      
[main]     ERR!     npm bugs @serialport/bindings
[main]     npm 
[main]     ERR!
[main]      Or if that isn't available, you can get their info via:
[main]     npm
[main]      ERR!     npm owner ls @serialport/bindings
[main]     npm
[main]      ERR!
[main]      There is likely additional logging output above.
[main]     
[main]     
[main]     
[main]     npm ERR! Please include the following file with any support request:
[main]     
[main]     npm
[main]      ERR!     /usr/src/app/npm-debug.log
[main]     
[main]     Removing intermediate container d81eaa66a61b
[main]     The command '/bin/sh -c apk add --no-cache make gcc g++ python py-pip  python-dev  &&   pip install rpi.gpio &&   npm install serialport &&   JOBS=MAX npm install -g node-red node-red-contrib-resinio --production --silent' returned a non-zero code: 1
[Info]     Uploading images
[Success]  Successfully uploaded images
[Error]    Some services failed to build:
[Error]      Service: main

Just going back to the basics here, the installation of node-red-contrib-modbus fails, so have tried installing serialport both ‘by hand’ on the terminal and also through the dockerfile (npm install serialport). :thinking:

Logs for reference:

19.11.18 09:58:26 (+0000)  main  19 Nov 09:58:26 - [info] Installing module: node-red-contrib-modbus, version: 4.1.1
19.11.18 10:00:32 (+0000)  main  19 Nov 10:00:32 - [warn] Installation of module node-red-contrib-modbus failed:
19.11.18 10:00:32 (+0000)  main  19 Nov 10:00:32 - [warn] ------------------------------------------
19.11.18 10:00:32 (+0000)  main  19 Nov 10:00:32 - [warn]
19.11.18 10:00:32 (+0000)  main  > @serialport/bindings@2.0.2 install /data/node-red/user/node_modules/@serialport/bindings
19.11.18 10:00:32 (+0000)  main  > prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild
19.11.18 10:00:32 (+0000)  main
19.11.18 10:00:32 (+0000)  main  prebuild-install WARN install No prebuilt binaries found (target=6.14.4 runtime=node arch=arm platform=linux)
19.11.18 10:00:32 (+0000)  main  make: Entering directory '/data/node-red/user/node_modules/@serialport/bindings/build'
19.11.18 10:00:32 (+0000)  main    CXX(target) Release/obj.target/bindings/src/serialport.o
19.11.18 10:00:32 (+0000)  main  ../src/serialport.cpp: In function 'void EIO_AfterOpen(uv_work_t*)':
19.11.18 10:00:32 (+0000)  main  ../src/serialport.cpp:95:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
19.11.18 10:00:32 (+0000)  main     data->callback.Call(2, argv);
19.11.18 10:00:32 (+0000)  main                                ^
19.11.18 10:00:32 (+0000)  main  In file included from ../src/./serialport.h:6:0,
19.11.18 10:00:32 (+0000)  main                   from ../src/serialport.cpp:1:
19.11.18 10:00:32 (+0000)  main  ../../../nan/nan.h:1655:3: note: declared here
19.11.18 10:00:32 (+0000)  main     Call(int argc, v8::Local<v8::Value> argv[]) const {
19.11.18 10:00:32 (+0000)  main     ^~~~
19.11.18 10:00:32 (+0000)  main  ../src/serialport.cpp: In function 'void EIO_AfterUpdate(uv_work_t*)':
19.11.18 10:00:32 (+0000)  main  ../src/serialport.cpp:150:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
19.11.18 10:00:32 (+0000)  main     data->callback.Call(1, argv);
19.11.18 10:00:32 (+0000)  main                                ^
19.11.18 10:00:32 (+0000)  main  In file included from ../src/./serialport.h:6:0,
19.11.18 10:00:32 (+0000)  main                   from ../src/serialport.cpp:1:
19.11.18 10:00:32 (+0000)  main  ../../../nan/nan.h:1655:3: note: declared here
19.11.18 10:00:32 (+0000)  main     Call(int argc, v8::Local<v8::Value> argv[]) const {
19.11.18 10:00:32 (+0000)  main     ^~~~
19.11.18 10:00:32 (+0000)  main  ../src/serialport.cpp: In function 'void EIO_AfterClose(uv_work_t*)':
19.11.18 10:00:32 (+0000)  main  ../src/serialport.cpp:188:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
19.11.18 10:00:32 (+0000)  main     data->callback.Call(1, argv);
19.11.18 10:00:32 (+0000)  main                                ^
19.11.18 10:00:32 (+0000)  main  In file included from ../src/./serialport.h:6:0,
19.11.18 10:00:32 (+0000)  main                   from ../src/serialport.cpp:1:
19.11.18 10:00:32 (+0000)  main  ../../../nan/nan.h:1655:3: note: declared here
19.11.18 10:00:32 (+0000)  main     Call(int argc, v8::Local<v8::Value> argv[]) const {
19.11.18 10:00:32 (+0000)  main     ^~~~
19.11.18 10:00:32 (+0000)  main  ../src/serialport.cpp: In function 'void EIO_AfterFlush(uv_work_t*)':
19.11.18 10:00:32 (+0000)  main  ../src/serialport.cpp:231:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
19.11.18 10:00:32 (+0000)  main     data->callback.Call(1, argv);
19.11.18 10:00:32 (+0000)  main                                ^
19.11.18 10:00:32 (+0000)  main  In file included from ../src/./serialport.h:6:0,
19.11.18 10:00:32 (+0000)  main                   from ../src/serialport.cpp:1:
19.11.18 10:00:32 (+0000)  main  ../../../nan/nan.h:1655:3: note: declared here
19.11.18 10:00:32 (+0000)  main     Call(int argc, v8::Local<v8::Value> argv[]) const {
19.11.18 10:00:32 (+0000)  main     ^~~~
19.11.18 10:00:32 (+0000)  main  ../src/serialport.cpp: In function 'void EIO_AfterSet(uv_work_t*)':
19.11.18 10:00:32 (+0000)  main  ../src/serialport.cpp:285:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
19.11.18 10:00:32 (+0000)  main     data->callback.Call(1, argv);
19.11.18 10:00:32 (+0000)  main                                ^
19.11.18 10:00:32 (+0000)  main  In file included from ../src/./serialport.h:6:0,
19.11.18 10:00:32 (+0000)  main                   from ../src/serialport.cpp:1:
19.11.18 10:00:32 (+0000)  main  ../../../nan/nan.h:1655:3: note: declared here
19.11.18 10:00:32 (+0000)  main     Call(int argc, v8::Local<v8::Value> argv[]) const {
19.11.18 10:00:32 (+0000)  main     ^~~~
19.11.18 10:00:32 (+0000)  main  ../src/serialport.cpp: In function 'void EIO_AfterGet(uv_work_t*)':
19.11.18 10:00:32 (+0000)  main  ../src/serialport.cpp:336:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
19.11.18 10:00:32 (+0000)  main     data->callback.Call(2, argv);
19.11.18 10:00:32 (+0000)  main                                ^
19.11.18 10:00:32 (+0000)  main  In file included from ../src/./serialport.h:6:0,
19.11.18 10:00:32 (+0000)  main                   from ../src/serialport.cpp:1:
19.11.18 10:00:32 (+0000)  main  ../../../nan/nan.h:1655:3: note: declared here
19.11.18 10:00:32 (+0000)  main     Call(int argc, v8::Local<v8::Value> argv[]) const {
19.11.18 10:00:32 (+0000)  main     ^~~~
19.11.18 10:00:32 (+0000)  main  ../src/serialport.cpp: In function 'void EIO_AfterGetBaudRate(uv_work_t*)':
19.11.18 10:00:32 (+0000)  main  ../src/serialport.cpp:383:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
19.11.18 10:00:32 (+0000)  main     data->callback.Call(2, argv);
19.11.18 10:00:32 (+0000)  main                                ^
19.11.18 10:00:32 (+0000)  main  In file included from ../src/./serialport.h:6:0,
19.11.18 10:00:32 (+0000)  main                   from ../src/serialport.cpp:1:
19.11.18 10:00:32 (+0000)  main  ../../../nan/nan.h:1655:3: note: declared here
19.11.18 10:00:32 (+0000)  main     Call(int argc, v8::Local<v8::Value> argv[]) const {
19.11.18 10:00:32 (+0000)  main     ^~~~
19.11.18 10:00:32 (+0000)  main  ../src/serialport.cpp: In function 'void EIO_AfterDrain(uv_work_t*)':
19.11.18 10:00:32 (+0000)  main  ../src/serialport.cpp:424:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
19.11.18 10:00:32 (+0000)  main     data->callback.Call(1, argv);
19.11.18 10:00:32 (+0000)  main                                ^
19.11.18 10:00:32 (+0000)  main  In file included from ../src/./serialport.h:6:0,
19.11.18 10:00:32 (+0000)  main                   from ../src/serialport.cpp:1:
19.11.18 10:00:32 (+0000)  main  ../../../nan/nan.h:1655:3: note: declared here
19.11.18 10:00:32 (+0000)  main     Call(int argc, v8::Local<v8::Value> argv[]) const {
19.11.18 10:00:32 (+0000)  main     ^~~~
19.11.18 10:00:32 (+0000)  main    CXX(target) Release/obj.target/bindings/src/serialport_unix.o
19.11.18 10:00:32 (+0000)  main  ../src/serialport_unix.cpp:24:26: fatal error: linux/serial.h: No such file or directory
19.11.18 10:00:32 (+0000)  main   #include <linux/serial.h>
19.11.18 10:00:32 (+0000)  main                            ^
19.11.18 10:00:32 (+0000)  main  compilation terminated.
19.11.18 10:00:32 (+0000)  main  make: *** [bindings.target.mk:95: Release/obj.target/bindings/src/serialport_unix.o] Error 1
19.11.18 10:00:32 (+0000)  main  make: Leaving directory '/data/node-red/user/node_modules/@serialport/bindings/build'
19.11.18 10:00:32 (+0000)  main  gyp ERR! build error
19.11.18 10:00:32 (+0000)  main  gyp ERR! stack Error: `make` failed with exit code: 2
19.11.18 10:00:32 (+0000)  main  gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
19.11.18 10:00:38 (+0000) Warning: Suppressed 13 message(s) due to slow reading
19.11.18 10:00:32 (+0000)  main  prebuild-install WARN install No prebuilt binaries found (target=6.14.4 runtime=node arch=arm platform=linux)
19.11.18 10:00:32 (+0000)  main  make: Entering directory '/data/node-red/user/node_modules/node-red-contrib-modbus/node_modules/modbus-serial/node_modules/serialport/build'
19.11.18 10:00:32 (+0000)  main    CXX(target) Release/obj.target/serialport/src/serialport.o
19.11.18 10:00:32 (+0000)  main  ../src/serialport.cpp: In function 'void EIO_AfterOpen(uv_work_t*)':
19.11.18 10:00:32 (+0000)  main  ../src/serialport.cpp:95:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
19.11.18 10:00:32 (+0000)  main     data->callback.Call(2, argv);
19.11.18 10:00:32 (+0000)  main                                ^
19.11.18 10:00:32 (+0000)  main  In file included from ../src/./serialport.h:6:0,
19.11.18 10:00:32 (+0000)  main                   from ../src/serialport.cpp:1:
19.11.18 10:00:32 (+0000)  main  ../../../../../../nan/nan.h:1655:3: note: declared here
19.11.18 10:00:32 (+0000)  main     Call(int argc, v8::Local<v8::Value> argv[]) const {
19.11.18 10:00:32 (+0000)  main     ^~~~
19.11.18 10:00:32 (+0000)  main  ../src/serialport.cpp: In function 'void EIO_AfterUpdate(uv_work_t*)':
19.11.18 10:00:32 (+0000)  main  ../src/serialport.cpp:150:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
19.11.18 10:00:32 (+0000)  main     data->callback.Call(1, argv);
19.11.18 10:00:32 (+0000)  main                                ^
19.11.18 10:00:32 (+0000)  main  In file included from ../src/./serialport.h:6:0,
19.11.18 10:00:32 (+0000)  main                   from ../src/serialport.cpp:1:
19.11.18 10:00:32 (+0000)  main  ../../../../../../nan/nan.h:1655:3: note: declared here
19.11.18 10:00:32 (+0000)  main     Call(int argc, v8::Local<v8::Value> argv[]) const {
19.11.18 10:00:32 (+0000)  main     ^~~~
19.11.18 10:00:32 (+0000)  main  ../src/serialport.cpp: In function 'void EIO_AfterClose(uv_work_t*)':
19.11.18 10:00:32 (+0000)  main  ../src/serialport.cpp:188:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
19.11.18 10:00:32 (+0000)  main     data->callback.Call(1, argv);
19.11.18 10:00:32 (+0000)  main                                ^
19.11.18 10:00:32 (+0000)  main  In file included from ../src/./serialport.h:6:0,
19.11.18 10:00:32 (+0000)  main                   from ../src/serialport.cpp:1:
19.11.18 10:00:32 (+0000)  main  ../../../../../../nan/nan.h:1655:3: note: declared here
19.11.18 10:00:32 (+0000)  main     Call(int argc, v8::Local<v8::Value> argv[]) const {
19.11.18 10:00:32 (+0000)  main     ^~~~
19.11.18 10:00:32 (+0000)  main  ../src/serialport.cpp: In function 'void EIO_AfterFlush(uv_work_t*)':
19.11.18 10:00:32 (+0000)  main  ../src/serialport.cpp:231:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
19.11.18 10:00:32 (+0000)  main     data->callback.Call(1, argv);
19.11.18 10:00:32 (+0000)  main                                ^
19.11.18 10:00:32 (+0000)  main  In file included from ../src/./serialport.h:6:0,
19.11.18 10:00:32 (+0000)  main                   from ../src/serialport.cpp:1:
19.11.18 10:00:32 (+0000)  main  ../../../../../../nan/nan.h:1655:3: note: declared here
19.11.18 10:00:32 (+0000)  main     Call(int argc, v8::Local<v8::Value> argv[]) const {
19.11.18 10:00:32 (+0000)  main     ^~~~
19.11.18 10:00:32 (+0000)  main  ../src/serialport.cpp: In function 'void EIO_AfterSet(uv_work_t*)':
19.11.18 10:00:32 (+0000)  main  ../src/serialport.cpp:285:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
19.11.18 10:00:32 (+0000)  main     data->callback.Call(1, argv);
19.11.18 10:00:32 (+0000)  main                                ^
19.11.18 10:00:32 (+0000)  main  In file included from ../src/./serialport.h:6:0,
19.11.18 10:00:32 (+0000)  main                   from ../src/serialport.cpp:1:
19.11.18 10:00:32 (+0000)  main  ../../../../../../nan/nan.h:1655:3: note: declared here
19.11.18 10:00:32 (+0000)  main     Call(int argc, v8::Local<v8::Value> argv[]) const {
19.11.18 10:00:32 (+0000)  main     ^~~~
19.11.18 10:00:32 (+0000)  main  ../src/serialport.cpp: In function 'void EIO_AfterGet(uv_work_t*)':
19.11.18 10:00:32 (+0000)  main  ../src/serialport.cpp:336:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
19.11.18 10:00:32 (+0000)  main     data->callback.Call(2, argv);
19.11.18 10:00:32 (+0000)  main                                ^
19.11.18 10:00:32 (+0000)  main  In file included from ../src/./serialport.h:6:0,
19.11.18 10:00:32 (+0000)  main                   from ../src/serialport.cpp:1:
19.11.18 10:00:32 (+0000)  main  ../../../../../../nan/nan.h:1655:3: note: declared here
19.11.18 10:00:32 (+0000)  main     Call(int argc, v8::Local<v8::Value> argv[]) const {
19.11.18 10:00:32 (+0000)  main     ^~~~
19.11.18 10:00:32 (+0000)  main  ../src/serialport.cpp: In function 'void EIO_AfterGetBaudRate(uv_work_t*)':
19.11.18 10:00:32 (+0000)  main  ../src/serialport.cpp:383:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
19.11.18 10:00:32 (+0000)  main     data->callback.Call(2, argv);
19.11.18 10:00:32 (+0000)  main                                ^
19.11.18 10:00:32 (+0000)  main  In file included from ../src/./serialport.h:6:0,
19.11.18 10:00:32 (+0000)  main                   from ../src/serialport.cpp:1:
19.11.18 10:00:32 (+0000)  main  ../../../../../../nan/nan.h:1655:3: note: declared here
19.11.18 10:00:32 (+0000)  main     Call(int argc, v8::Local<v8::Value> argv[]) const {
19.11.18 10:00:32 (+0000)  main     ^~~~
19.11.18 10:00:32 (+0000)  main  ../src/serialport.cpp: In function 'void EIO_AfterDrain(uv_work_t*)':
19.11.18 10:00:32 (+0000)  main  ../src/serialport.cpp:424:30: warning: 'v8::Local<v8::Value> Nan::Callback::Call(int, v8::Local<v8::Value>*) const' is deprecated [-Wdeprecated-declarations]
19.11.18 10:00:32 (+0000)  main     data->callback.Call(1, argv);
19.11.18 10:00:32 (+0000)  main                                ^
19.11.18 10:00:32 (+0000)  main  In file included from ../src/./serialport.h:6:0,
19.11.18 10:00:32 (+0000)  main                   from ../src/serialport.cpp:1:
19.11.18 10:00:32 (+0000)  main  ../../../../../../nan/nan.h:1655:3: note: declared here
19.11.18 10:00:32 (+0000)  main     Call(int argc, v8::Local<v8::Value> argv[]) const {
19.11.18 10:00:32 (+0000)  main     ^~~~
19.11.18 10:00:32 (+0000)  main    CXX(target) Release/obj.target/serialport/src/serialport_unix.o
19.11.18 10:00:32 (+0000)  main  ../src/serialport_unix.cpp:24:26: fatal error: linux/serial.h: No such file or directory
19.11.18 10:00:32 (+0000)  main   #include <linux/serial.h>
19.11.18 10:00:32 (+0000)  main                            ^
19.11.18 10:00:32 (+0000)  main  compilation terminated.
19.11.18 10:00:32 (+0000)  main  make: *** [serialport.target.mk:95: Release/obj.target/serialport/src/serialport_unix.o] Error 1
19.11.18 10:00:32 (+0000)  main  make: Leaving directory '/data/node-red/user/node_modules/node-red-contrib-modbus/node_modules/modbus-serial/node_modules/serialport/build'
19.11.18 10:00:32 (+0000)  main  gyp ERR! build error
19.11.18 10:00:32 (+0000)  main  gyp ERR! stack Error: `make` failed with exit code: 2
19.11.18 10:00:32 (+0000)  main  gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
19.11.18 10:00:32 (+0000)  main  gyp ERR! stack     at emitTwo (events.js:106:13)
19.11.18 10:00:32 (+0000)  main  gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
19.11.18 10:00:32 (+0000)  main  gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:219:12)
19.11.18 10:00:32 (+0000)  main  gyp ERR! System Linux 4.14.68

UPDATE:

Looks like I’ve sorted it! Apologies for the many posts, but I hope this serves useful for others in the future. I was reading through https://serialport.io/docs/en/guide-installation and noticed the ‘installation for Alpine Linux’ section. I added the build commands to my dockerfile and all works good now! You need to remove the sudos mind :wink:

This is what this part of my dockerfile looks like now:

RUN apk add --no-cache make gcc g++ python py-pip  python-dev  && \
  pip install rpi.gpio && \
  apk add --no-cache nodejs  && \
  apk add --no-cache make gcc g++ python linux-headers udev && \
  npm install serialport --build-from-source --unsafe-perm && \
  JOBS=MAX npm install -g node-red node-red-contrib-resinio --production --silent