fix: enforce clinical npm install by removing ghost lockfiles and using --omit=optional

This commit is contained in:
Timothy Hofland
2026-03-11 08:23:07 +01:00
parent ea5615f620
commit 686185a625

View File

@ -183,10 +183,13 @@ chown -R "$REAL_USER:$REAL_USER" "$REAL_HOME/mpvj" "$REAL_HOME/media"
# 4.2 Build
export NODE_OPTIONS="--max-old-space-size=512"
cd "$REAL_HOME/mpvj/backend"
sudo -u "$REAL_USER" npm install --jobs 1 --no-optional
# Clean up any ghost dependencies from git or previous runs
rm -rf node_modules package-lock.json
sudo -u "$REAL_USER" npm install --jobs 1 --omit=optional
cd "$REAL_HOME/mpvj/frontend"
if [ ! -d "dist" ]; then
sudo -u "$REAL_USER" npm install --jobs 1 --no-optional
rm -rf node_modules package-lock.json
sudo -u "$REAL_USER" npm install --jobs 1 --omit=optional
sudo -u "$REAL_USER" npm run build
fi