When adding the line: "volume: ./backend:/app" in the docker-compose.yml file the backend crashes when building up

Please, excuse my English. It is my second language… I may have some errors.

In the section Running Multi-Container Applications, class No. 11, minute 00:57, explains that we need to add a volume mapping the directory of the backend to the app directory in the container, so any changes applied to the directory in our host, will be applied to the container without building the image again.
However, when doing this, an application that was running before with no problem, stopped running after this line. As soon as I remove it, it runs again the whole application, both: front and backend.

I already tried to solve it using AI ChatGPT4, implementing all type of changes, nothing worked. I completely deleted all type of images, containers, volumes, cache files, everything and rebuilt everything from scratch, nothing worked. I also modified the permissions of the file, it did not work as well. I installed the same version of nodejs and npm used in when doing this class. It did not work as well. I installed greater versions and it did not work as well. I even changed the permissions to 777 (which is crazy, I know), it did not work either.

This is the error:

“Attaching to vidly_db_1, vidly_backend_1, vidly_frontend_1
backend_1 | internal/modules/cjs/loader.js:883
backend_1 | throw err;
backend_1 | ^
backend_1 |
backend_1 | Error: Cannot find module ‘/app/docker-entrypoint.sh’
backend_1 | at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
backend_1 | at Function.Module._load (internal/modules/cjs/loader.js:725:27)
backend_1 | at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
backend_1 | at internal/main/run_main_module.js:17:47 {
backend_1 | code: ‘MODULE_NOT_FOUND’,
backend_1 | requireStack:
backend_1 | }”

I must mention that none of the previous answers listed below, solves the problem:

Also, as I mentioned, AI could not solve it as well.
Please, advise what to do. :slight_smile:

Thanks

1 Like