Clean startup of dev environment fails to start frontend container.
Steps to reproduce
Clone repository
Run docker-compose -f docker-compose.yml --profile dev up in repository root
2a. To make logs more readable, you can run docker-compose -f docker-compose.yml --profile dev up fregepoc-frontend-dev or use some kind of UI to see logs of fregepoc-frontend-dev container
Check logs and see output similar to
2023-03-06 20:39:53 > frontend@0.1.0 start
2023-03-06 20:39:53 > react-scripts start
2023-03-06 20:39:48 sh: react-scripts: not found
Potential cause
Frontend tries to start on clean node image without installed requirements. This error can go unnoticed when the environment is started from the developer machine due to the fact that node_modules directory is being added as a volume. It may prevent clean release (to on-prem server, vendor cloud etc.) in the future.
Quick solution
Go to frontend directory cd frontend and run npm install. After that, the node_modules directory will be attached as a volume to the container, fixing the issue.
Proposed solutions
Create custom Docker image that will install required dependencies, for instance:
FROM node:current-alpine
COPY package.json .
COPY package-lock.json .
RUN npm install
Add new points to readme that describe npm installation and node modules installation processes
Outline
Clean startup of dev environment fails to start frontend container.
Steps to reproduce
docker-compose -f docker-compose.yml --profile dev up
in repository root 2a. To make logs more readable, you can rundocker-compose -f docker-compose.yml --profile dev up fregepoc-frontend-dev
or use some kind of UI to see logs offregepoc-frontend-dev
containerPotential cause
Frontend tries to start on clean
node
image without installed requirements. This error can go unnoticed when the environment is started from the developer machine due to the fact thatnode_modules
directory is being added as a volume. It may prevent clean release (to on-prem server, vendor cloud etc.) in the future.Quick solution
Go to
frontend
directorycd frontend
and runnpm install
. After that, thenode_modules
directory will be attached as a volume to the container, fixing the issue.Proposed solutions