I’ve got a nodejs/npm service that has been running reliably on raspberry pi 4, for the last few months, however as of a few days ago I seem to be getting the error “ts-node: Not Found” on the devices when I try and run the nodejs server. Any help with this is appreciated.
Hey @SpencerWF ,
Can you share your Dockerfile/docker-compose.yml file? Feel free to redact anything that you do not wish to share here.
Also, exactly what command results in that error, and did you happen to upgrade your service or any balena components recently?
Thanks and regards,
Pranav
Thanks Pranav,
docker-compose.yml
version: '2.1'
volumes:
redis-data:
services:
arcade:
build: ./arcade
restart: always
depends_on:
- redis
ports:
- "80:80"
labels:
io.balena.features.dbus: '1'
redis:
image: redis
restart: always
volumes:
- 'redis-data:/data'
expose:
- "6379"
Dockerfile.template for arcade
# see more about dockerfile templates here: https://www.balena.io/docs/learn/develop/dockerfile/
FROM balenalib/%%BALENA_MACHINE_NAME%%-ubuntu-node:latest
LABEL maintainer="Spencer Walker-Fooks <spencer@unseengames.com>"
# use `install_packages` if you need to install dependencies,
# for instance if you need git, just uncomment the line below.
# RUN install_packages git
RUN install_packages dnsmasq wireless-tools wget network-manager
WORKDIR /usr/
RUN curl https://api.github.com/repositories/37727198/releases/latest -s \
| grep -hoP 'browser_download_url": "\K.*%%RESIN_ARCH%%\.tar\.gz' \
| xargs -n1 curl -Ls \
| tar -xvz -C /usr/
COPY scripts/start.sh ./
COPY scripts/ ./scripts
COPY scripts/lobby.timer /etc/systemd/system/lobby.timer
# COPY rooms/ rooms/
# COPY static/ static/
# COPY templates/ templates/
COPY *.json ./
# COPY config.js ./
# COPY index.ts ./
# COPY routes.ts ./
# COPY views/ views/
# COPY lib/ ./lib
# COPY dmloader.js ./
# COPY games/games.json ./games/games.json
COPY package.json ./package.json
# COPY package-lock.json ./package-lock.json
COPY src/ ./src
# COPY .env* ./
#Setup cron task to start multiplayer games every 4 minutes
# RUN echo "*/4 * * * * /usr/src/scripts/lobby.sh" | crontab
# Enable udevd so that plugged dynamic hardware devices show up in our container.
# ENV UDEV=1
# ENV DEVICE="embedded"
ENV PORT="80"
# server.js will run when container starts up on the device
CMD ["bash", "start.sh"]
start.sh
#!/usr/bin/env bash
# Moved below line to disable_ipv6.sh file
# export DBUS_SYSTEM_BUS_ADDRESS=unix:path=/host/run/dbus/system_bus_socket
if [[ ! -v WIFI_CHECK_COMPLETE ]]; then
apt-get update && apt-get install network-manager
sleep 15
# Is there Internet connectivity via a google ping?
wget --spider http://google.com 2>&1
export WIFI_CHECK_COMPLETE="true"
fi
# 4. Is there an active WiFi connection?
# iwgetid -r
# chmod 755 ./scripts/disable_ipv6.sh
# sudo ./scripts/disable_ipv6.sh
if [ $? -eq 0 ]; then
printf 'Skipping WiFi Connect\n'
else
printf 'Starting WiFi Connect\n'
./wifi-connect
fi
# printf 'Removing pre-existing node_modules and package-lock file\n'
# rm -r node_modules
# rm package-lock.json
printf 'Starting Unseen Arcade Application\n'
# Start your application here
printf 'NPM Install Command Starting\n'
npm install
# npm install -g pm2
printf 'Running NPM Start Command\n'
npm start