Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not load seeders! #313

Open
jagoanmamah opened this issue Dec 26, 2023 · 2 comments
Open

Could not load seeders! #313

jagoanmamah opened this issue Dec 26, 2023 · 2 comments

Comments

@jagoanmamah
Copy link

Screenshot 2023-12-26 at 07 55 37


Screenshot 2023-12-26 at 07 54 19

@jorgebodega
Copy link
Owner

Sorry, I cannot work just with an image without any context.

Please, try to create a reproducible example in a repo, or at least, a decent amount of code.

@6uliver
Copy link

6uliver commented Feb 12, 2024

I ran into the same issue, I debugged it: the problem is that the "run" method receives the following array as paths: [ 'seed', './seed/0_clear.ts', './seed/1_create_users.ts', ... ]

@jagoanmamah did you have a seed folder too? Based on the image your case can be a different one.

The root cause is that the seed command is prepended to the paths array (maybe the "commander" package is misused) and if you store the seeds under a folder named "seed" you can see this error message because we try to load the module from that folder.

I figured out two workarounds, both of them are working independently:

  1. Remove the "seed" command when calling the CLI (for me it's something like that: ts-node -r tsconfig-paths/register ./node_modules/@jorgebodega/typeorm-seeding/dist/cli.js -d ./data-source.ts ./seed/*.ts)
  2. Rename the "seed" folder to something else, for example "seeders": (for me it's something like that: ts-node -r tsconfig-paths/register ./node_modules/@jorgebodega/typeorm-seeding/dist/cli.js seed -d ./data-source.ts ./seeders/*.ts)

I don't have time to fix this issue and send a PR but I hope these informations are going to help you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants