zwave-js / node-red-contrib-zwave-js

The most powerful, high performing and highly polished Z-Wave node for Node-RED based on Z-Wave JS. If you want a fully featured Z-Wave framework in your Node-RED instance, you have found it.
MIT License
47 stars 6 forks source link

[Help]: Node-RED crashes when selecting the USB port in the ZWave Controller node #269

Closed normanth closed 1 year ago

normanth commented 1 year ago

How can we help?

Raspberry Pi 4 (Raspberry Pi OS Lite (64-bit) Debian Bullseye) Docker version: 23.0.1 Node-RED image from nodered/node-red:latest - version v3.0.2 Linux Alpine 3.16.1 Node.js version v16.16.0 ZWave-JS version 8.0.0

Docker run with USB device: docker run -it --net=host --user root --device=/dev/ttyACM0 --restart=unless-stopped -v /node-red/data-1:/data -e TZ=Europe/Berlin --name node-red-3-0-2 ft/node-red:3-0-2

Installation protocol of ZWave-JS:

2023-03-27T12:33:05.395Z Installieren : node-red-contrib-zwave-js 8.0.0

2023-03-27T12:33:09.350Z npm install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict node-red-contrib-zwave-js@8.0.0
2023-03-27T12:33:10.573Z [err] npm
2023-03-27T12:33:10.574Z [err]  WARN 
2023-03-27T12:33:10.575Z [err] config production Use `--omit=dev` instead.
2023-03-27T12:33:35.012Z [out] 
2023-03-27T12:33:35.012Z [out] added 136 packages in 25s
2023-03-27T12:33:35.051Z rc=0

After selection of serial port "/dev/ttyACM0" in ZWave-JS "ZWave Controller" Node-RED crashes and doesn't start anymore.

Log-File:

14:39:27.640 DRIVER   ███████╗ ██╗    ██╗  █████╗  ██╗   ██╗ ███████╗             ██╗ ███████╗
                      ╚══███╔╝ ██║    ██║ ██╔══██╗ ██║   ██║ ██╔════╝             ██║ ██╔════╝
                        ███╔╝  ██║ █╗ ██║ ███████║ ██║   ██║ █████╗   █████╗      ██║ ███████╗
                       ███╔╝   ██║███╗██║ ██╔══██║ ╚██╗ ██╔╝ ██╔══╝   ╚════╝ ██   ██║ ╚════██║
                      ███████╗ ╚███╔███╔╝ ██║  ██║  ╚████╔╝  ███████╗        ╚█████╔╝ ███████║
                      ╚══════╝  ╚══╝╚══╝  ╚═╝  ╚═╝   ╚═══╝   ╚══════╝         ╚════╝  ╚══════╝
14:39:27.646 DRIVER   version 10.12.0
14:39:27.647 DRIVER
14:39:27.649 DRIVER   starting driver...
14:39:27.686 DRIVER   opening serial port /dev/ttyACM0
27 Mar 14:39:27 - [info] Started flows
./entrypoint.sh: line 14:     7 Segmentation fault      (core dumped) /usr/local/bin/node $NODEOPTIONS node_modules/node-red/red.js --userDir /data $FLOWS

I have found this: https://github.com/serialport/node-serialport/issues/2438 mlooise commented on Aug 27, 2022

But installation of "npm install node-red-node-serialport@0.15.0" in the Docker Container doesn't work.

bash-5.1# npm install node-red-node-serialport@0.15.0

added 43 packages, and audited 338 packages in 30s

52 packages are looking for funding
  run `npm fund` for details

7 vulnerabilities (5 low, 1 moderate, 1 high)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
bash-5.1# npm version node-red-node-serialport
npm ERR! Invalid version: node-red-node-serialport

npm ERR! A complete log of this run can be found in:
npm ERR!     /data/.npm/_logs/2023-03-27T14_07_54_295Z-debug-0.log

Version

8.0.0

Node-RED Version

3.0.2

What hardware are you using?

Raspberry Pi

Any code to add?

marcus-j-davies commented 1 year ago

Hi @normanth.

This is certainly always a problem with the serial port package in Alpine Linux (Docker)

Please see this comment. https://github.com/zwave-js/node-red-contrib-zwave-js/discussions/246#discussioncomment-4023531

In essence, you need to ensure all build tools are installed in your Docker image and run npm rebuild --build-from-source INSIDE the docker image environment and within your .node-red directory - not outside.

I cant tell you where your .node-red directory is when using docker.

Basically, the prebuilt serilaport package binary for Alpine just doesnt work, and you need to build it your self.

and again make sure npm rebuild --build-from-source is run inside your docker environment and from within the .node-red directory or what ever directory it is for docker

fabnavigator commented 1 year ago

Hi @normanth, my two cents are to run node-red outside of docker for this. I was all in using docker, and finally gave up trying to get it to work. I've been very happy with my decision.

normanth commented 1 year ago

Hi,

unfortunately, the rebuild in .node-red in the docker container (folder with node_modules inside) did not solve the problem.

Now I've installed node-red on the Raspberry without docker and it works. It's a pity that it doesn't work with docker - that brings decisive advantages.

Now I can switch from node-red-contrib-openzwave to node-red-contrib-zwave-js.

Many thanks for the support!

Norman