I have it running quite well now. I’m checking a bit on the Zigbee2MQTT service and using the USB device at /dev/ttyACM0
. I triggered the API /api/v1/service/usb/port
, but I got a 404 Not Found
error.
After checking, I found that UsbController
failed to run due to the following error:
SERVICE_LOAD_ERROR Error: /src/server/services/usb/node_modules/@serialport/bindings/build/Release/bindings.node: invalid ELF header
at Module._extensions..node (node:internal/modules/cjs/loader:1460:18)
at Module.load (node:internal/modules/cjs/loader:1203:32)
at Module._load (node:internal/modules/cjs/loader:1019:12)
at Module.require (node:internal/modules/cjs
I researched a bit and found that this issue seems related to the build architecture. However, I built it on a Mac M1 and used the following command to build:
ARG TARGET
ARG VERSION
ARG BUILD_DATE
FROM --platform=linux/arm64 ${TARGET}/node:18-slim
LABEL \
org.label-schema.build-date=$BUILD_DATE \
org.label-schema.version=$VERSION
COPY qemu-* /usr/bin/
# System dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
tzdata \
nmap \
ffmpeg \
sqlite3 \
openssl \
gzip \
udev \
bluez \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /tmp
# Install Gladys
RUN mkdir /src
WORKDIR /src
ADD . /src
# COPY ./static /src/server/static
WORKDIR /src/server
# Install build dependencies and application dependencies
RUN apt-get update && apt-get install -y \
build-essential \
python3 \
python3-pip \
git \
libffi-dev && \
apt-get clean
RUN npm install --unsafe-perm --production
RUN npm cache clean --force \
&& apt-get autoremove -y build-essential python3 python3-pip git libffi-dev \
&& apt-get purge -y --auto-remove \
&& rm -rf /var/lib/apt/lists/*
ENV NODE_ENV production
ENV SERVER_PORT 80
# Export listening port
EXPOSE 80
CMD ["node", "index.js"]
Please give me advice and a solution to fix this issue. Thank you very much!