Rpi docker node-red not working with node-red-contrib-home-assistant-websocket

Been struggling with this for over a month since my last rpi reinstall.
So I have a docker-compose stack:

  hass:
    hostname: hass
    container_name: hass
    restart: unless-stopped
    image: homeassistant/raspberrypi3-homeassistant
    ports:
      - "8123:8123"
    devices:
      - /dev/ttyUSB0:/dev/ttyUSB0
      - /dev/ttyUSB1:/dev/ttyUSB1
      - /dev/ttyACM0:/dev/ttyACM0
    volumes:
      - ${USERDIR}/docker/homeassistant:/config
      - ${USERDIR}/docker/shared:/shared
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
    network_mode: host
    privileged: true
    environment:
      - PUID
      - PGID
      - TZ
    labels:
      - "traefik.enable=true"
      - "traefik.frontend.rule=Host:hass.${DOMAINNAME}"
      - "traefik.port=8123"
    healthcheck:
      test: ["CMD", "curl", "-f", "http://127.0.0.1:8123"]
      interval: 30s
      timeout: 10s
      retries: 6
  nodered-v8:
    user: root
    container_name: nodered-v8
    hostname: nodered-v8
    image: nodered/node-red-docker:rpi-v8
    ports:
      - 1888:1880
      - 9288:9229
    volumes:
      - ${USERDIR}/docker/nodered-v8:/data
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/timezone:ro
    restart: unless-stopped
    depends_on:
      - mosquitto
      # - mqtt-bridge
      - hass
    healthcheck:
      test: ["CMD", "curl", "-f", "http://127.0.0.1:1888"]
      interval: 30s
      timeout: 10s
      retries: 5
    labels:
      - "traefik.enable=true"
      - "traefik.frontend.rule=Host:nodered-v8.${DOMAINNAME}"
      - "traefik.frontend.entryPoints=http,https"
      - "traefik.backend=nodered-v8"
      - "traefik.port=1888"
      - "com.centurylinklabs.watchtower.enable=true"
    networks:
      - traefik_proxy

I’ve tried countless of docker images, tags, what not… Every time, when I install the node-red-contrib-home-assistant-websocket I get errors when installing:
ReferenceError: nodeVersion is not defined
And after restarting I see:

2019-07-06T11:07:27.150000799Z 6 Jul 14:07:27 - [info] Installed module: node-red-contrib-home-assistant-websocket
2019-07-06T11:07:30.329841253Z 6 Jul 14:07:30 - [info] Added node types:
2019-07-06T11:07:30.330159999Z 6 Jul 14:07:30 - [info]  - node-red-contrib-home-assistant-websocket:server : SyntaxError: Unexpected token ...
2019-07-06T11:07:30.331664044Z 6 Jul 14:07:30 - [info]  - node-red-contrib-home-assistant-websocket:server-events : SyntaxError: Unexpected token ...
2019-07-06T11:07:30.331808262Z 6 Jul 14:07:30 - [info]  - node-red-contrib-home-assistant-websocket:server-state-changed : SyntaxError: Unexpected token ...
2019-07-06T11:07:30.331852844Z 6 Jul 14:07:30 - [info]  - node-red-contrib-home-assistant-websocket:trigger-state : SyntaxError: Unexpected token ...
2019-07-06T11:07:30.331888313Z 6 Jul 14:07:30 - [info]  - node-red-contrib-home-assistant-websocket:poll-state : SyntaxError: Unexpected token ...
2019-07-06T11:07:30.331923364Z 6 Jul 14:07:30 - [info]  - node-red-contrib-home-assistant-websocket:api-call-service : SyntaxError: Unexpected token ...
2019-07-06T11:07:30.331960395Z 6 Jul 14:07:30 - [info]  - node-red-contrib-home-assistant-websocket:ha-fire-event : SyntaxError: Unexpected token ...
2019-07-06T11:07:30.331997114Z 6 Jul 14:07:30 - [info]  - node-red-contrib-home-assistant-websocket:api-current-state : SyntaxError: Unexpected token ...
2019-07-06T11:07:30.344227600Z 6 Jul 14:07:30 - [info]  - node-red-contrib-home-assistant-websocket:ha-get-entities : SyntaxError: Unexpected token ...
2019-07-06T11:07:30.344393900Z 6 Jul 14:07:30 - [info]  - node-red-contrib-home-assistant-websocket:api-get-history : SyntaxError: Unexpected token ...
2019-07-06T11:07:30.344438639Z 6 Jul 14:07:30 - [info]  - node-red-contrib-home-assistant-websocket:api-render-template : SyntaxError: Unexpected token ...
2019-07-06T11:07:30.344476764Z 6 Jul 14:07:30 - [info]  - node-red-contrib-home-assistant-websocket:ha-wait-until : SyntaxError: Unexpected token ...
2019-07-06T11:07:30.344512545Z 6 Jul 14:07:30 - [info]  - node-red-contrib-home-assistant-websocket:ha-api : SyntaxError: Unexpected token ...

Please help

try version 0.13.1 with raymondmm/node-red container

From here:

rpi-v8 docker container using node.js 8.1.0 and this package needs at least 8.12. You need to upgrade node.js within the container.

See also this workaround.

any idea how to update it?
Trying npm i -g node and it asks for permissions. added user: root to the docker-compose. Same error.

I also had strange errors inside the container (which is from a very old image).
I ended up rebuilding my own nodered image from node:12-stretch and it seems to work… (maybe nodered isn’t intended to work with a recent node version, I’m new to it, guess I’ll find out sooner or later :slight_smile: