Nest throws at startup that it can't resolve the dependencies of
OrdersServiceNest throws an error at startup. Providers are encapsulated: importing a module only gives you what that module lists in exports. UsersService is not exported, so Nest stops during bootstrap with a "can't resolve dependencies" error.
"It works, because importing a module gives access to all its providers" is wrong, because importing only exposes exported providers. Nest also never creates a hidden second instance, and it never injects undefined.
Read more
- Modules (https://docs.nestjs.com/modules)docs.nestjs.com