Cannot find module '@nestjs/typeorm' Cannot find module '@nestjs/typeorm' docker docker

Cannot find module '@nestjs/typeorm'


In the above Dockerfile and in the sample shared by DolDurma, during the development step, only the development dependencies are installed. This means that when typescript tries to find things like @nestjs/typeorm, @nestjs/common and @nestjs/core, along with any other packages taht are required to run the build and run the application, it can't, so it throws an error about not being able to find the package or its type declarations. The easiest solution is on line 9 of the Dockerfile to change from RUN npm install --only=development to RUN npm install. This will install all of the dependencies, and the docker container will be able to build properly. Then docker compose up will work (the instances above will not run because both bind to port 3000, but you can do docker compose up dev and it should be fine)

It looks like with the sample for DolDurma some extra dependencies still need to be installed, but the container does build and attempts to start with the above modification