How to start Node.js server using local add-on?

I have tried to start Node.js. server using Docker and custom add-on.

This is my Dockerfile



ADD package.json /

RUN apk add --no-cache nodejs-npm jq && \
npm install --save


# Copy data for add-on
COPY server.js /
COPY .env /
RUN chmod a+x /

CMD [ "/" ]

And this is my

#!/usr/bin/with-contenv bashio

node server.js

When I start the add-on it starts successfully and this is the log

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm64"})
+ [email protected]
added 1 package from 1 contributor, removed 1 package, updated 1 package and audited 469 packages in 22.268s
33 packages are looking for funding
  run `npm fund` for details
found 34 vulnerabilities (17 low, 2 moderate, 15 high)
  run `npm audit fix` to fix them, or `npm audit` for details
Express listening on port 8000!

This is the config.json

  "name": "Hello world",
  "version": "1",
  "slug": "hello_world",
  "description": "My first real add-on!",
  "arch": ["armhf", "armv7", "aarch64", "amd64", "i386"],
  "startup": "application",
  "boot": "auto",
  "options": {},
  "schema": {},
  "ports": {
    "8000/tcp": 8000

But when I open http://my-local-home-assistant-ip:8000/, I got

This site can’t be reached

While when I run the same command on my mac and open http://localhost:8000/ it’s working successfully.

Did you end up fixing it?
I’m struggling…

1 Like