-
Notifications
You must be signed in to change notification settings - Fork 418
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
🐛 Bug Report: ERR_MODULE_NOT_FOUND When Running Database Seed Script #501
Comments
@VineeTagarwaL-code I would like to raise a PR to fix this issue; please assign it to me |
There's not a kind of fix issue for this... Before making the change seed script was this:
and it was also raising this issue After making the change:
|
both seeding scripts were failing on my side
Not sure if it works on your end |
Thanks for the insights, @CuriousCoder00! I found that the issue arises from the use of the --import flag in the seeding script. After some investigation, the ERR_MODULE_NOT_FOUND occurs because the --import flag isn’t properly supported in this context. To fix this, I will switch to using the --loader flag in the scripts section of the package.json as it provides a more stable and expected behavior with ES module loading. I have tested it, and it works on my end. Final script would look something like following in the scripts in package.json: "scripts": { |
so is it open or solved? |
@NalinDalal i raised pr which solves the issue, but isn't merged yet |
📜 Description
When attempting to run the database seed script using the command: npm run db:seed
👟 Reproduction steps
👍 Expected behavior
The database seed script should run without any errors, and the data should be seeded successfully.
👎 Actual Behavior with Screenshots
An ERR_MODULE_NOT_FOUND error is thrown, indicating that the package cannot be found.
OS name
Windows
browser name
Firefox
npm version
No response
node version
No response
📃 Provide any additional context for the Bug.
The issue seems to stem from the way the --import flag is used in the command. The command that causes the error:
node --import 'data:text/javascript,import { register } from "node:module"; import { pathToFileURL } from "node:url"; register("ts-node/esm", pathToFileURL("./"));' prisma/seed.ts
possible fix would be to use the --loader option instead of --import.
👀 Have you spent some time to check if this bug has been raised before?
🏢 Have you read the Contributing Guidelines?
Are you willing to submit PR?
Yes I am willing to submit a PR!
The text was updated successfully, but these errors were encountered: