Help. How to make an Addon with nodejs

I would like a example of local addon with nodejs and install some packaje.json.

I al trying but i have a error.

Thanks.

1 Like

this is my code:

ARG BUILD_FROM
FROM $BUILD_FROM

ENV LANG C.UTF-8

RUN apk add --no-cache nodejs nodejs-npm 

# use changes to package.json to force Docker not to use the cache
# when we change our application's nodejs dependencies
COPY  package.json /tmp/package.json
RUN cd /tmp 
RUN npm install 
RUN mkdir -p /app
RUN cp -a /tmp/node_modules /app
RUN cd /app

WORKDIR /app
COPY . /app

# Copy data for add-on
#COPY run.sh /
RUN chmod a+x /run.sh

CMD [ "/run.sh" ]

the error is:

docker.errors.BuildError: The command '/bin/sh -c cp -a /tmp/node_modules /app' returned a non-zero code: 1

Did you ever figure it out?

Have a look at https://github.com/helmut-hoffer-von-ankershoffen/hassio-ring-bridge for a NodeJS based addon - in this case a bridge from Home Assistant to Ring