When I build the NestJS application inside a docker container with docker-compose, it builds without any errors. But the VS-code file explorer is showing all my files have errors with missing modules. Please refer to screen shots as below:
Please help.
Since you haven't run npm i
or the yarn equivalent, node modules folder is not populated with the actual node packages/files.
Keep in mind that as @omidh said in his comment, when you run the docker command, you make an isolate environment/container with your code and all node_modules installed correctly. That means that your code is copied inside the container, then inside the container the command npm install
is being run and your code is compiled/run eventually.
So that is the reason that your container runs without any error and your editor is showing errors.