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

Error: Cannot find module './typeorm-seeding' #317

Open
angelxmoreno opened this issue Jan 21, 2024 · 0 comments
Open

Error: Cannot find module './typeorm-seeding' #317

angelxmoreno opened this issue Jan 21, 2024 · 0 comments

Comments

@angelxmoreno
Copy link

running

yarn ts-node typeorm-seeding -d src/data-source.ts src/seeders/**/*.ts

Throws the error:

yarn run v1.22.19
warning package.json: No license field
$ /Users/user/project/typeorm-seeding-example/node_modules/.bin/ts-node typeorm-seeding -d src/data-source.ts src/seeders/CreateUsers.ts
node:internal/modules/cjs/loader:1080
throw err;
^

Error: Cannot find module './typeorm-seeding'
Require stack:
- /Users/user/project/typeorm-seeding-example/imaginaryUncacheableRequireResolveScript
  at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
  at Function.resolve (node:internal/modules/cjs/helpers:125:19)
  at requireResolveNonCached (/Users/user/project/typeorm-seeding-example/node_modules/ts-node/dist/bin.js:549:16)
  at getProjectSearchDir (/Users/user/project/typeorm-seeding-example/node_modules/ts-node/dist/bin.js:519:40)
  at phase3 (/Users/user/project/typeorm-seeding-example/node_modules/ts-node/dist/bin.js:267:27)
  at bootstrap (/Users/user/project/typeorm-seeding-example/node_modules/ts-node/dist/bin.js:47:30)
  at main (/Users/user/project/typeorm-seeding-example/node_modules/ts-node/dist/bin.js:33:12)
  at Object.<anonymous> (/Users/user/project/typeorm-seeding-example/node_modules/ts-node/dist/bin.js:579:5)
  at Module._compile (node:internal/modules/cjs/loader:1256:14)
  at Module._extensions..js (node:internal/modules/cjs/loader:1310:10) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
  '/Users/user/project/typeorm-seeding-example/imaginaryUncacheableRequireResolveScript'
  ]
}

Node.js v18.18.2
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I took a look at typeorm-seeding-example and noticed that

ts-node ./node_modules/@jorgebodega/typeorm-seeding/dist/cli.js seed -d src/data-source.ts src/seeders/**/*.ts

does work. however, I am in a monorepo and strongly prefer not relying on the node_modules path.

What am I doing wrong?

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

1 participant