Fix: Add .npmrc config and improve npm install robustness

This commit is contained in:
innotex
2026-02-05 00:43:46 +01:00
parent de89cf1ecb
commit 061131b166
2 changed files with 13 additions and 4 deletions

5
.npmrc Normal file
View File

@@ -0,0 +1,5 @@
legacy-peer-deps=true
audit=false
fund=false
progress=false
omit=dev

View File

@@ -2,13 +2,17 @@ FROM node:18-alpine
WORKDIR /app
# Copy npm config first
COPY .npmrc ./
# Copy package files
COPY backend/package*.json ./
# Install dependencies - bypass npm bugs
RUN npm ci --omit=dev || npm install --omit=dev || true && \
npm install --save express express-session bcryptjs dotenv cors multer fs-extra && \
if [ ! -d node_modules/express ]; then echo "ERROR: express not installed" && exit 1; fi
# Install dependencies with retry logic
RUN npm cache clean --force && \
npm install --no-optional --legacy-peer-deps 2>&1 | tail -20 && \
ls -la node_modules/express || npm install express && \
test -d node_modules/express || (echo "FATAL: express not found" && exit 1)
# Copy application code
COPY backend/src ./src