首页 > 解决方案 > docker container exited with "Local package.json exists, but node_modules missing, did you mean to install?" message

问题描述

I'm trying to setup docker containers for fullstack app: express, react. But something goes wrong and api container doesn't work. Can you help me please https://github.com/flyoozes/react-full-stack

标签: node.jsdocker

解决方案


when you specify volumes in docker-compose.yml file it mounts folder when running container. And in your case docker overrides /srv/app/api folder and as result node_modules missing. You can comment out volumes for api services and the container will work.

However is better to add /srv/app/api/node_modules as 2nd volume to api service. This will mount the node_modules directory to the host machine using the buildtime directory.


推荐阅读