javascriptnode.jsormnestjstypeorm

EntityMetadataNotFound: No metadata for "Task" was found - NestJS


I am learning the NestJS course from Udemy https://www.udemy.com/course/nestjs-zero-to-hero.

And I am stuck with a strange issue and I have tried many things but nothing seems to be working. Here is the issue and complete code that I have.

Error that I am getting

Error that I am getting

My ORM configuration file:

ORM Configuration file

**Task Entity File: ** enter image description here

Finally I am importing the configuration file in tasks.module.ts file enter image description here

People facing there issue have resolved it with different fixes,

  1. Some said that we might be adding misspelled file name or path in configuration that might have caused this issue.
  2. Some said that changing from npm to yarn has fixed the issue.
  3. And few also said that the issue is with ORM itself.

I have tried all possible solutions that are available over the internet but was not able to fix this. Its been quite few days now and I am looking for a helping hand or savior on stack overflow.

Meanwhile, I will try to see a few more possibilities that could help but if you have faced this issue do let me know the possible solutions.


Solution

  • You're missing the @Entity() decorator on your Task class. This sets the metadata that TypeORM is looking for according to its docs.