UniversityOfSaskatchewanCMPT371 / term-project-2024-team-4

Apache License 2.0
2 stars 2 forks source link

`node_modules` not updated upon installing removing a dependency in Docker #91

Closed lecegues closed 8 months ago

lecegues commented 8 months ago

This problem arises when going to another branch that has different dependencies. It seems that Docker will reuse the node_modules cache from the past branch, so any new, updated, or removed dependencies will not be reflected.

Problem: Docker uses cache to reduce the time it takes to build and run containers. We believe that the node_modules folder is being reused rather than being updated

lecegues commented 8 months ago

This problem was inside our "FAQ" section in our GitHub wiki; however, we've decided to abolish that as GitHub issues is a better-centralized place to document common issues and solutions.

lecegues commented 8 months ago

Solution: After switching to a branch that has different dependencies, rebuild the image using docker-compose build --no-cache <service-name>. For example, if a dependency was added to the "backend" service (names specified in docker-compose.yaml), then the command would be docker-compose build --no-cache backend