'Docker compose fails with frontend service in node js project

While I have no problem with backend service and database service, I am having problems with frontend as well. I have looked at the solutions facing this problem, how can I solve it

error image shell docker compose

dockerfile frontend:

WORKDIR /usr/src/app
COPY package.json /usr/src/app
RUN npm install && npm install nodemon
COPY . /usr/src/app
EXPOSE 3000
RUN npm run build```

docker compose file :

```version: "3.9"
services:
  
  frontend:
    build: ./client
    ports:
      - 3000:3000
    stdin_open: true
    volumes:
      - ./frontend:/usr/src/app
      - /usr/src/app/node_modules
    restart: on-failure
    command: npm start
    networks:
      - react-express
    depends_on:
      - backend
      
 



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source