fix: Resolve nodemon not found error in development Docker
- Explicitly set NODE_ENV=development during npm install to include devDependencies - Add NODE_ENV=development environment variable in Dockerfile - Add fallback dev:node script using Node.js --watch flag - Ensure nodemon is installed with other development dependencies This fixes the "sh: nodemon: not found" error in the development container. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node src/app.js",
|
"start": "node src/app.js",
|
||||||
"dev": "nodemon src/app.js",
|
"dev": "nodemon src/app.js",
|
||||||
|
"dev:node": "node --watch src/app.js",
|
||||||
"test": "jest --coverage",
|
"test": "jest --coverage",
|
||||||
"lint": "eslint src/",
|
"lint": "eslint src/",
|
||||||
"lint:fix": "eslint src/ --fix"
|
"lint:fix": "eslint src/ --fix"
|
||||||
|
|||||||
@@ -18,8 +18,9 @@ RUN addgroup -g 1000 -S nodejs && \
|
|||||||
# Copy package files
|
# Copy package files
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
|
|
||||||
# Install dependencies as root
|
# Install all dependencies (including devDependencies for development)
|
||||||
RUN npm install
|
# Make sure NODE_ENV is not set to production during install
|
||||||
|
RUN NODE_ENV=development npm install
|
||||||
|
|
||||||
# Create necessary directories
|
# Create necessary directories
|
||||||
RUN mkdir -p logs temp && \
|
RUN mkdir -p logs temp && \
|
||||||
@@ -34,6 +35,9 @@ RUN chown -R nodejs:nodejs /app
|
|||||||
# Switch to non-root user
|
# Switch to non-root user
|
||||||
USER nodejs
|
USER nodejs
|
||||||
|
|
||||||
|
# Set development environment
|
||||||
|
ENV NODE_ENV=development
|
||||||
|
|
||||||
# Expose port
|
# Expose port
|
||||||
EXPOSE 7510
|
EXPOSE 7510
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user