ts-node throwing RepositoryNotFoundError
See original GitHub issueHere is the example repo. https://github.com/zackarychapple/flagger
When I am starting the server with nodemon everything initializes correctly however when seed tries to run it bombs out with the below error. I tried several paths for mapping to my entities however it seems none of them pick up. Any thoughts?
(node:99829) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): RepositoryNotFoundError: No repository for "FlagsEntity" was found. Looks like this entity is not registered in current "default" connection?
(node:99829) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Issue Analytics
- State:
- Created 6 years ago
- Comments:18 (3 by maintainers)
Top Results From Across the Web
RepositoryNotFoundError : TypeORM - Stack Overflow
ts used when locally running with ts-node; js used when having built for ... but during the run time, it's going to throw...
Read more >Troubleshooting | ts-node - TypeStrong · GitHub
This error is thrown by node when a module has an unrecognized file extension, or no extension at all, and is being executed...
Read more >Graphql And Typeorm: "No Repository Was Found - ADocLib
TypeORM version: Test with: mocha --require ts-node/register '. RepositoryNotFoundError is throw in case your entity isnt properly registered in My solution ...
Read more >Complete guide to using TypeORM and TypeScript for data ...
npm install typescript ts-node --save-dev ... throw new Error(`Student id ${util.inspect(id)} did not retrieve a Student`); }
Read more >Getting TypeORM to work with Next.js and TypeScript
I tried to use ts-node to compile TS modules on the fly as they get loaded ... RepositoryNotFoundError: No repository for "User" was...
Read more >
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I also had the same
No repository for ... in current "default" connection
and it worked fine for development (running with nodemon), but failed after tsc compilation running under node. I had to change:to:
I see a reference to this in the typeorm docs, is this the prescribed way for dealing with entities in typescript? (https://typeorm.github.io/connection.html#creating-connection)
no, it depends how you run your app. If you are running via
ts-node
then you can use “.ts” files as entities. If you aren’t usingts-node
then you must specify “.js” files. And you need to make sure to specify proper output directory (if you are using outDir tsc option) to ensure paths to your generated js files are correct.