# Install / Run Zwave in Node Red Docker Image (on RPi)

**URL:** <https://discourse.nodered.org/t/install-run-zwave-in-node-red-docker-image-on-rpi/13467>\
**Category:** General\
**Created:** [19 July 2019 05:59 UTC](https://discourse.nodered.org/t/install-run-zwave-in-node-red-docker-image-on-rpi/13467 "2019-07-19T05:59:21Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Qaldak](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/qaldak/32/10292_2.png) [@Qaldak](https://discourse.nodered.org/u/Qaldak)\
**Post date:** [19 July 2019 05:59 UTC](https://discourse.nodered.org/t/install-run-zwave-in-node-red-docker-image-on-rpi/13467/1 "2019-07-19T05:59:21Z")

</div>

Hi all

I try to implement Node-Red for my home automatisation.  
Node-Red runs in Docker on my Raspberry Pi. This works without any problems.

But I need Zwave for my Fibaro Motion Sensors.  
And I can not install node-red-contrib-openzwave. It failes, because openzwave library and openzwave-shared are not installed in the Docker-Image.

But installation of these dependencies failed each time (in Docker):

```auto
pm info it worked if it ends with ok
npm info using npm@5.0.3
npm info using node@v8.1.3
npm http fetch GET 304 https://registry.npmjs.org/openzwave-shared 517ms (from cache)
npm http fetch GET 304 https://registry.npmjs.org/nan 131ms (from cache)
npm info lifecycle openzwave-shared@1.5.6~preinstall: openzwave-shared@1.5.6
npm info lifecycle nan@2.14.0~preinstall: nan@2.14.0

> openzwave-shared@1.5.6 preinstall /usr/src/node-red/node_modules/openzwave-shared
> node lib/install-ozw.js

npm info linkStuff openzwave-shared@1.5.6
npm info linkStuff nan@2.14.0
npm info lifecycle openzwave-shared@1.5.6~install: openzwave-shared@1.5.6

> openzwave-shared@1.5.6 install /usr/src/node-red/node_modules/openzwave-shared
> node-gyp rebuild

gyp info it worked if it ends with ok
gyp info using node-gyp@3.6.2
gyp info using node@8.1.3 | linux | arm
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/usr/src/node-red/node_modules/openzwave-shared/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/usr/src/node-red/.node-gyp/8.1.3/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/usr/src/node-red/.node-gyp/8.1.3',
gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/usr/src/node-red/.node-gyp/8.1.3/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/usr/src/node-red/node_modules/openzwave-shared',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.' ]
grep: /usr/*/include/value_classes: No such file or directory
gyp: Call to 'grep -r GetTypeNameFromEnum /usr/*/include/value_classes | wc -l' returned exit status 0 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:336:16)
gyp ERR! stack at emitTwo (events.js:125:13)
gyp ERR! stack at ChildProcess.emit (events.js:213:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:197:12)
gyp ERR! System Linux 4.14.97-v7+
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/src/node-red/node_modules/openzwave-shared
gyp ERR! node -v v8.1.3
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm info lifecycle openzwave-shared@1.5.6~install: Failed to exec install script
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! openzwave-shared@1.5.6 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the openzwave-shared@1.5.6 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /usr/src/node-red/.npm/_logs/2019-07-17T19_47_45_676Z-debug.log

```

How can I install the dependencies for node-red-contrib-openzwave?

If I start install with 'sudo', it asks for node-red password. How can I set / activate node-red password?  
Do I have to change AdminAuth parameter in settings.js?

Does someone installed node-red-contrib-openzwave in docker-env?

Thanks for your inputs.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [19 July 2019 06:18 UTC](https://discourse.nodered.org/t/install-run-zwave-in-node-red-docker-image-on-rpi/13467/2 "2019-07-19T06:18:04Z")

</div>

Do you need to use docker? It makes life a lot more complex and I am not aware of any great advantage on a pi.

---

<div class="post-metadata">

**Author:** ![Qaldak](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/qaldak/32/10292_2.png) [@Qaldak](https://discourse.nodered.org/u/Qaldak)\
**Post date:** [19 July 2019 07:52 UTC](https://discourse.nodered.org/t/install-run-zwave-in-node-red-docker-image-on-rpi/13467/3 "2019-07-19T07:52:10Z")

</div>

not necessarily.  
But I wanted to do the tests with Docker and Docker would be my target.

But somehow it should be possible to add the Node Red password. Maybe that will help.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [19 July 2019 10:49 UTC](https://discourse.nodered.org/t/install-run-zwave-in-node-red-docker-image-on-rpi/13467/4 "2019-07-19T10:49:44Z")

</div>

you probably need to custom build your docker container with the extra libraries or build tools in - start with a copy of the node-red dockerfile and go from there.

---

<div class="post-metadata">

**Author:** ![Qaldak](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/qaldak/32/10292_2.png) [@Qaldak](https://discourse.nodered.org/u/Qaldak)\
**Post date:** [19 July 2019 13:07 UTC](https://discourse.nodered.org/t/install-run-zwave-in-node-red-docker-image-on-rpi/13467/5 "2019-07-19T13:07:05Z")

</div>

Of course,... you're right. I didn't think about that.  
I will try.

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [19 July 2019 13:48 UTC](https://discourse.nodered.org/t/install-run-zwave-in-node-red-docker-image-on-rpi/13467/6 "2019-07-19T13:48:57Z")

</div>

Running "[native](https://nodered.org/docs/getting-started/raspberrypi)" node-red makes it all much easier.

---

<div class="post-metadata">

**Author:** ![Qaldak](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/qaldak/32/10292_2.png) [@Qaldak](https://discourse.nodered.org/u/Qaldak)\
**Post date:** [21 July 2019 17:37 UTC](https://discourse.nodered.org/t/install-run-zwave-in-node-red-docker-image-on-rpi/13467/7 "2019-07-21T17:37:35Z")

</div>

I solved the first few issues. I installed prerequisits via  
`docker exec -it -u root node-red /bin/bash`

openzwave-shared I installed also.

But after install 'node-red-contrib-openzwave' (directly in node-red), my node-red docker instance was broken.

```auto
npm ERR! Failed at the node-red-docker@1.0.0 start script 'node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS "--userDir" "/data"'.,
npm ERR! This is most likely a problem with the node-red-docker package,,
npm ERR! not with npm itself.,
npm ERR! Tell the author that this fails on your system:,
npm ERR! node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS "--userDir" "/data",
npm ERR! You can get their info via:,
npm ERR! npm owner ls node-red-docker,
npm ERR! There is likely additional logging output above.,
,
npm ERR! Please include the following file with any support request:,
npm ERR! /usr/src/node-red/npm-debug.log,
npm info it worked if it ends with ok,
npm info using npm@2.14.7,
m info using node@v4.2.1,
npm info prestart node-red-docker@1.0.0,
npm info start node-red-docker@1.0.0,
,
> node-red-docker@1.0.0 start /usr/src/node-red,
> node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS "--userDir" "/data",
,
/usr/src/node-red/node_modules/fs-extra/lib/fs/index.js:93,
exports.write = function (fd, buffer, ...args) {,
                                      ^^^,
,
SyntaxError: Unexpected token ...,
    at exports.runInThisContext (vm.js:53:16),
    at Module._compile (module.js:414:25),
    at Object.Module._extensions..js (module.js:442:10),
    at Module.load (module.js:356:32),
    at Function.Module._load (module.js:311:12),
    at Module.require (module.js:366:17),
    at require (module.js:385:17),
    at Object.<anonymous> (/usr/src/node-red/node_modules/fs-extra/lib/index.js:6:3),
    at Module._compile (module.js:435:26),
    at Object.Module._extensions..js (module.js:442:10),
,
npm info node-red-docker@1.0.0 Failed to exec start script,
m ERR! Linux 4.14.97-v7+,
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start" "--" "--userDir" "/data",
npm ERR! node v4.2.1,
npm ERR! npm v2.14.7,
npm ERR! code ELIFECYCLE,
npm ERR! node-red-docker@1.0.0 start: `node $NODE_OPTIONS node_modules/node-red/red.js -v $FLOWS "--userDir" "/data"`,
npm ERR! Exit status 1,,

```

anyone an idea?  
@bakman2: Yes, I suppose so too. 😉 But I would like to use Docker - at least for tests.

---

<div class="post-metadata">

**Author:** ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)\
**Post date:** [21 July 2019 17:51 UTC](https://discourse.nodered.org/t/install-run-zwave-in-node-red-docker-image-on-rpi/13467/8 "2019-07-21T17:51:16Z")

</div>

Is this the version of node you’re using?  
`node v4.2.1`  
If so please be aware that current versions of Node-RED require v8.5 or higher as minimum. The LTS releases are supported.

This specific error is caused by a syntax introduced in newer JavaScript versions, this one first supported in ES6, and coincidentally NodeJS 6.0.0 as well. It’s the rest parameters syntax for function arguments.

> `SyntaxError: Unexpected token ...,`

> **[Rest parameters - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters)**
>
> The rest parameter syntax allows a function to accept an indefinite number of arguments as an array, providing a way to represent variadic functions in JavaScript.

---

<div class="post-metadata">

**Author:** ![Qaldak](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/qaldak/32/10292_2.png) [@Qaldak](https://discourse.nodered.org/u/Qaldak)\
**Post date:** [23 July 2019 05:44 UTC](https://discourse.nodered.org/t/install-run-zwave-in-node-red-docker-image-on-rpi/13467/9 "2019-07-23T05:44:56Z")

</div>

> [@afelix](#):
>
> Is this the version of node you’re using?  
> `node v4.2.1`

this is node-version on my raspberry pi.  
is this the issue on building a own docker image?

which node / npm version should it be on the raspi?

* * *

it seems it's realy much easier to install native instead of docker image.😉  
I know which components are needed, but on every build it crashes. I just do some tests. If failed I change to a native installation.

---

<div class="post-metadata">

**Author:** ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)\
**Post date:** [23 July 2019 05:58 UTC](https://discourse.nodered.org/t/install-run-zwave-in-node-red-docker-image-on-rpi/13467/10 "2019-07-23T05:58:06Z")

</div>

if it's the version on your pi, rather than inside your container, somehow your setup is using the wrong node. I didn't know docker containers were able to use locally installed software on the host machine. Sounds like a sandboxing issue to be honest. So I guess something is going wrong on that pi, if the wrong node is used. Because looking at the output it suggests that this is the Node version _inside_ the container.

What command were you using to get that output, and can you post your Dockerfile?

---

<div class="post-metadata">

**Author:** ![Qaldak](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/qaldak/32/10292_2.png) [@Qaldak](https://discourse.nodered.org/u/Qaldak)\
**Post date:** [23 July 2019 07:11 UTC](https://discourse.nodered.org/t/install-run-zwave-in-node-red-docker-image-on-rpi/13467/11 "2019-07-23T07:11:26Z")

</div>

> [@afelix](#):
>
> What command were you using to get that output,

from Portainer: Container log

here is my dockerfile

```auto
ARG NODE_VERSION=8
FROM hypriot/rpi-node:${NODE_VERSION}

# add support for gpio library
RUN apt-get update
RUN apt-get install python-rpi.gpio

# install prerequisits for openzwave
RUN apt-get update \
  && apt-get install -y --no-install-recommends \
    libkrb5-dev \
    libudev-dev \
    libudev0 \
    libzmq3-dev \
  && rm -rf /var/lib/apt/lists/* \
  && apt-get clean

RUN wget "http://node-arm.herokuapp.com/node_latest_armhf.deb" \
  && wget "https://github.com/ekarak/openzwave-debs-raspbian/raw/master/v1.4.79/openzwave_1.4.79.gfaea7dd_armhf.deb" \
  && wget "https://github.com/ekarak/openzwave-debs-raspbian/raw/master/v1.4.79/libopenzwave1.3_1.4.79.gfaea7dd_armhf.deb" \
  && wget "https://github.com/ekarak/openzwave-debs-raspbian/raw/master/v1.4.79/libopenzwave1.3-dev_1.4.79.gfaea7dd_armhf.deb" \
  && dpkg -i *.deb \
  && rm *.deb

# Home directory for Node-RED application source code.
RUN mkdir -p /usr/src/node-red

# User data directory, contains flows, config and nodes.
RUN mkdir /data

WORKDIR /usr/src/node-red

# Add node-red user so we aren't running as root.
RUN useradd --home-dir /usr/src/node-red --no-create-home node-red \
    && chown -R node-red:node-red /data \
    && chown -R node-red:node-red /usr/src/node-red

USER node-red

# package.json contains Node-RED NPM module and node dependencies
COPY package.json /usr/src/node-red/
RUN npm install

# User configuration directory volume
EXPOSE 1880

# Environment variable holding file path for flows configuration
ENV FLOWS=flows.json
ENV NODE_PATH=/usr/src/node-red/node_modules:/data/node_modules

CMD ["npm", "start", "--", "--userDir", "/data"]

```

maybe, the problem is install node\_latest\_armhf.deb, but I couldn't test today.

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [24 July 2019 06:51 UTC](https://discourse.nodered.org/t/install-run-zwave-in-node-red-docker-image-on-rpi/13467/12 "2019-07-24T06:51:10Z")

</div>

If you are new to Node-red, docker and Z-Wave i would suggest to you that this is madness.

Start with a native install of Node-red on your RPI (start with a new SD card so you can experiment) once you have that down and working and your Z wave stuff recognized you can decide if you want to turn that into a docker image.

I would suggest you learn a lot more about docker, pass through USB devices and the like before you start down that track though

Craig

---

<div class="post-metadata">

**Author:** ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)\
**Post date:** [24 July 2019 08:56 UTC](https://discourse.nodered.org/t/install-run-zwave-in-node-red-docker-image-on-rpi/13467/13 "2019-07-24T08:56:58Z")

</div>

> [@Qaldak](#):
>
> maybe, the problem is install node\_latest\_armhf.deb, but I couldn't test today.

I took the `.deb` apart and I'm pretty sure it is the problem. Do you know why you are using this step for installing? Installing that `node_latest_armhf.deb` file overwrites the Node.JS version already present in your docker image, which is supposed to be node 8 according to the hypriot image.

The `node_latest_armhf.deb` got created in 2015 and does in fact install the Node 4.2.1 seen before in the error messages. Here's the control file for Debian packages inside it:

```auto
Package: node
Priority: extra
Section: checkinstall
Installed-Size: 34396
Maintainer: <redacted to prevent spam>
Architecture: armhf
Version: 4.2.1-1
Provides: node
Description: node v4.2.1

```

Date of packaging can be seen as October 18th 2015.

Removing this deb from the list might already solve your issue, but as Craig mentioned before me, start with getting a native install that is completely correct. To get there, document all your steps, then take the basic node-red-docker Dockerfile and abstract your documentation to an install procedure.

---

<div class="post-metadata">

**Author:** ![Qaldak](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/qaldak/32/10292_2.png) [@Qaldak](https://discourse.nodered.org/u/Qaldak)\
**Post date:** [24 July 2019 10:48 UTC](https://discourse.nodered.org/t/install-run-zwave-in-node-red-docker-image-on-rpi/13467/14 "2019-07-24T10:48:16Z")

</div>

Well, I didn't assumed, I'm the first to want to run Node-Red with Zwave and MQTT in a Docker container.  
But it seems I am. 😉

@afelix Thank you for your inputs. I will just check it out.

But for now, I will change to a native installation.

---

<div class="post-metadata">

**Author:** ![Pavel](https://avatars.discourse-cdn.com/v4/letter/p/a4c791/32.png) [@Pavel](https://discourse.nodered.org/u/Pavel)\
**Post date:** [2 February 2020 09:17 UTC](https://discourse.nodered.org/t/install-run-zwave-in-node-red-docker-image-on-rpi/13467/15 "2020-02-02T09:17:23Z")

</div>

Hi. Have you managed to go back to docker-ized install with custom nodes? Or have you decided to stay with native?

---

<div class="post-metadata">

**Author:** ![Qaldak](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/qaldak/32/10292_2.png) [@Qaldak](https://discourse.nodered.org/u/Qaldak)\
**Post date:** [2 February 2020 10:21 UTC](https://discourse.nodered.org/t/install-run-zwave-in-node-red-docker-image-on-rpi/13467/16 "2020-02-02T10:21:13Z")

</div>

Hi, I changed to native installation. With native installation it runs without any problems.
