Gustavo
08/23/2022, 9:39 AMDATABASE_URL
which is working fine for migrations, but now for seeding i'm unsure how to proceed 🤔
In my script I tried running:
const seeds = spawnSync('npx', ['ts-node', './src/package/package_1/prisma/seed.ts']);
but i get the error:
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module './seed.ts'
Require stack:
- /application/src/packages/package_1/prisma/imaginaryUncacheableRequireResolveScript
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.resolve (node:internal/modules/cjs/helpers:108:19)
at requireResolveNonCached (/application/node_modules/ts-node/dist/bin.js:549:16)
at getProjectSearchDir (/application/node_modules/ts-node/dist/bin.js:519:40)
at phase3 (/application/node_modules/ts-node/dist/bin.js:267:27)
at bootstrap (/application/node_modules/ts-node/dist/bin.js:47:30)
at main (/application/node_modules/ts-node/dist/bin.js:33:12)
at Object.<anonymous> (/application/node_modules/ts-node/dist/bin.js:579:5)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/application/src/packages/package_1/prisma/imaginaryUncacheableRequireResolveScript'
]
}
Any ideas? 😄 Thanks in advance 🙂Gustavo
08/23/2022, 10:27 AMRaphael Etim
08/23/2022, 10:33 AMRaphael Etim
08/23/2022, 10:33 AMGustavo
08/23/2022, 10:33 AMRaphael Etim
08/23/2022, 10:58 AMGustavo
08/23/2022, 11:14 AMprisma
prop specified in my `package.json`as:
"prisma": {
"seed": "ts-node prisma/seed.ts"
},
like docs show, the thing here is that as I have several, i need to run command from the specific package location first.
In my example using spawnSync
I needed to pass the option: cwd
to specify the location from which the command should be ran.Raphael Etim
08/23/2022, 11:36 AM