{ EntityMetadataNotFound: No metadata for "User" was found.

See original GitHub issue

Hello, I’m trying to setup a new project using the latest release and the ormconfig.yml options.

I’m following the documentation and pointing it to the src/entity/*.js location, but i keep getting the following error when running my server.spec.ts file through mocha:

{ EntityMetadataNotFound: No metadata for "User" was found.
    at EntityMetadataNotFound.Error (native)
    at new EntityMetadataNotFound (/Users/paco/projects/mezcal/server/src/error/EntityMetadataNotFound.ts:7:9)
    at Connection.getMetadata (/Users/paco/projects/mezcal/server/src/connection/Connection.ts:297:19)
    at EntityManager.<anonymous> (/Users/paco/projects/mezcal/server/src/entity-manager/EntityManager.ts:310:54)
    at step (/Users/paco/projects/mezcal/server/node_modules/typeorm/entity-manager/EntityManager.js:32:23)
    at Object.next (/Users/paco/projects/mezcal/server/node_modules/typeorm/entity-manager/EntityManager.js:13:53)
    at /Users/paco/projects/mezcal/server/node_modules/typeorm/entity-manager/EntityManager.js:7:71
    at __awaiter (/Users/paco/projects/mezcal/server/node_modules/typeorm/entity-manager/EntityManager.js:3:12)
    at /Users/paco/projects/mezcal/server/src/entity-manager/EntityManager.ts:280:39
  name: 'EntityMetadataNotFound',
  message: 'No metadata for "User" was found.' }

I’ve posted a sample repo here: https://github.com/rightisleft/public-error https://github.com/rightisleft/public-error/blob/master/server/test/server.spec.ts#L29

I’ve been reading the documentation at https://github.com/typeorm/typeorm/issues/420 but have been unable to resolve the problem.

Please advise.

Checklist: Using reflect-metadata in spec Using “emitDecoratorMetadata”: true, “experimentalDecorators”: true in tsconfig.json Using ‘entries’ delcaration in ormconfig.yml

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:23
  • Comments:45 (1 by maintainers)

github_iconTop GitHub Comments

92reactions
mlaopanecommented, Jun 17, 2018

In my case, I just needed to change this :

entities: [
    __dirname + "/entity/*.js"
],

Into this :

entities: [
    __dirname + "/entity/*.ts"
],
59reactions
mohsanabbascommented, Mar 6, 2020

entities: [__dirname + '/../**/*.entity.{js,ts}']

Read more comments on GitHub >

github_iconTop Results From Across the Web

No metadata for "User" was found using TypeOrm
Inserting a new user into the database... { EntityMetadataNotFound: No metadata for "User" was found. at new EntityMetadataNotFoundError ...
Read more >
TypeORM - No metadata for "User" was found. - Reddit
TypeORM : EntityMetadataNotFound: No metadata for "User" was found. Hey all! Hoping some typeORM experts can help me out, burned wayyy to ...
Read more >
Fix for EntityMetadataNotFound: No metadata was found in ...
Solution for EntityMetadataNotFound: No metadata for was found. The entity is a Typescript class that maps to a table in the database.
Read more >
no metadata for was found. - You.com | The AI Search Engine ...
Solution for EntityMetadataNotFound: No metadata for was found The entity is a Typescript class that maps to a table in the database. If...
Read more >
typeorm/typeorm - Gitter
{ EntityMetadataNotFound: No metadata for "User" was found. at new EntityMetadataNotFoundError (/Users/admin/work/typeorm-naming-strategy/src/error/ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found