我尝试使用命令将模式从 prismadb 安装到本地 postgres 数据库:
npx prisma db push --schema='calcom/packages/prisma/schema.prisma'
但是出现错误
另外我已经安装了 ts-node 还需要安装什么吗?
Error: Generator "ts-node --transpile-only ./enum-generator" failed:
node:internal/modules/cjs/loader:998
throw err;
^
Error: Cannot find module './enum-generator'
Require stack:
- /home/dev/calcom-docker/imaginaryUncacheableRequireResolveScript
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
at Function.resolve (node:internal/modules/cjs/helpers:109:19)
at requireResolveNonCached (/home/dev/.nvm/versions/node/v16.19.0/lib/node_modules/ts-node/dist/bin.js:549:16)
at getProjectSearchDir (/home/dev/.nvm/versions/node/v16.19.0/lib/node_modules/ts-node/dist/bin.js:519:40)
at phase3 (/home/dev/.nvm/versions/node/v16.19.0/lib/node_modules/ts-node/dist/bin.js:267:27)
at bootstrap (/home/dev/.nvm/versions/node/v16.19.0/lib/node_modules/ts-node/dist/bin.js:47:30)
at main (/home/dev/.nvm/versions/node/v16.19.0/lib/node_modules/ts-node/dist/bin.js:33:12)
at Object.<anonymous> (/home/dev/.nvm/versions/node/v16.19.0/lib/node_modules/ts-node/dist/bin.js:579:5)
at Module._compile (node:internal/modules/cjs/loader:1165:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1219:10) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/dev/calcom-docker/imaginaryUncacheableRequireResolveScript'
]
}
当我和你一样使用 calcom 时,我多次遇到这个错误。每次我对 schema.prisma 进行更改时,我都会运行
npx prisma migrate dev
并且最终会出现此错误。
要解决这个问题,有效的方法是:在创建迁移文件后,运行yarn dx
,这将生成没有任何错误的 prisma 客户端。