BreeeZe/rpos

I error MODULE_NOT_FOUND when I try to start rpos in docker?

lpt2007 opened this issue · 0 comments

dockerfile:


FROM ghcr.io/home-assistant/armhf-base-raspbian:bullseye

# Install requirements for add-on
RUN apt-get update && apt-get install -y \
    nodejs \
    npm \
    liblivemedia-dev \
    liblivemedia-dev \
    liblog4cpp5-dev \
    cmake \
    libasound2-dev \
    v4l-utils
    
# So let's set it to our add-on persistent data directory.
WORKDIR /data

# install onvif server
# install npm and node.js (latest 17 in 26.3.22)
RUN npm install -g n \
    && n install 17
RUN git clone https://github.com/BreeeZe/rpos.git \
    && cd rpos \
    && npm install
    
# So let's set it to our add-on persistent data/rpos directory.
WORKDIR /data/rpos 

RUN npx gulp
#RUN npm install -g gulp
#RUN npm install gulp
#    && sh setup_v4l2rtspserver.sh
    
# instal v4l2rtspserver
RUN git clone https://github.com/mpromonet/v4l2rtspserver.git \
    && cd v4l2rtspserver/ \
    && cmake . \
    && make \
    && make install

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

CMD ["/bin/sh","/run.sh"]

run.sh file:

#!/usr/bin/with-contenv bashio

echo "ONVIF server started"
cd /data/rpos
echo "go to directory /data/rpos"
/usr/local/bin/node /data/rpos/rpos.js

ERROR:

node:internal/modules/cjs/loader:936
  throw err;
  ^
Error: Cannot find module '/data/rpos/rpos.js'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
Node.js v17.8.0

When I run image mannualy using command:
docker run --rm -it --device /dev/video0 -p 8554:8554 --entrypoint bash image-name
and run command, rpos starts normaly without error:
/bin/sh /run.sh