node_modules missing even after npm install in docker container
I had the same problem and I solved it just following this instruction. Add one line of code - /usr/src/app/node_modules
to the docker-compose.yml file in the volumes:
volumes: - ${PWD-.}/name_of_your_app:/usr/src/app - /usr/src/app/node_modules
Update: I just ended up using only ./app/src
folder as a volume, instead of ./app
.
This way, /app/node_modules
is not overridden by the host's volume.
version: '3'services: app: container_name: app restart: always build: context: ./app dockerfile: Dockerfile-dev ports: - "8080:8080" volumes: - ./app/src:/usr/src/app/src # <---- this - ./logs:/logs