zod-prisma 一直卡在生成步骤

zod-prisma keeps getting stuck at the generation step

我刚刚安装 zod-prisma 来试用一下,但到目前为止没有任何效果。

我试图 运行 它在两个不同的项目上,一个有一个小棱镜,另一个有一个相对较大的棱镜。

两者都不起作用,并且仍然卡住了。

很遗憾,我无法共享架构。那么,您知道问题出在哪里吗?

我在tsconfig里也开启了strict,还是一样

prisma                  : 3.6.0
@prisma/client          : 3.6.0
Current platform        : debian-openssl-1.1.x
Query Engine (Node-API) : libquery-engine dc520b92b1ebb2d28dc3161f9f82e875bd35d727 (at node_modules/@prisma/engines/libquery_engine-debian-openssl-1.1.x.so.node)
Migration Engine        : migration-engine-cli dc520b92b1ebb2d28dc3161f9f82e875bd35d727 (at node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x)
Introspection Engine    : introspection-core dc520b92b1ebb2d28dc3161f9f82e875bd35d727 (at node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x)
Format Binary           : prisma-fmt dc520b92b1ebb2d28dc3161f9f82e875bd35d727 (at node_modules/@prisma/engines/prisma-fmt-debian-openssl-1.1.x)
Default Engines Hash    : dc520b92b1ebb2d28dc3161f9f82e875bd35d727
Studio                  : 0.440.0
typescript": "^4.5.2"
"zod-prisma": "^0.5.4"
{
  "compilerOptions": {
    "target": "es2018",
    "module": "commonjs",
    "lib": ["es2018", "esnext.asynciterable"],
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "declaration": true,
    "removeComments": true,
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "sourceMap": false,
    "outDir": "./dist",
    "baseUrl": "./",
    "incremental": true,
    "skipLibCheck": true,
    "strictNullChecks": false,
    "noImplicitAny": false,
    "strictBindCallApply": false,
    "forceConsistentCasingInFileNames": false,
    "noFallthroughCasesInSwitch": false,
    "strict": true
  }
}

我也克隆了 repo 中的示例,但它根本没有配置 zod-prisma。所以,我从自述文件中添加了这个:

generator zod {
  provider = "zod-prisma"
  output   = "./zod"

  relationModel = true
  // relationModel         = "default" // Do not export model without relations.
  // relationModel         = false // Do not generate related model

  modelCase = "PascalCase"
  // modelCase             = "camelCase" // Output models using camel case (ex. userModel, postModel)

  modelSuffix = "Model"

  // useDecimalJs          = false // (default) represent the prisma Decimal type using as a JS number
  useDecimalJs = true

  imports = null

  // https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-by-null-values
  prismaJsonNullability = true
  // prismaJsonNullability = false // allows null assignment to optional JSON fields
}

但是当我 运行 npx prisma generate

时它也卡住了

我使用节点 v14.19.1

我升级到最新的 prisma 版本:

prisma                  : 3.13.0
@prisma/client          : 3.13.0
Current platform        : debian-openssl-1.1.x
Query Engine (Node-API) : libquery-engine efdf9b1183dddfd4258cd181a72125755215ab7b (at node_modules/@prisma/engines/libquery_engine-debian-openssl-1.1.x.so.node)
Migration Engine        : migration-engine-cli efdf9b1183dddfd4258cd181a72125755215ab7b (at node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x)
Introspection Engine    : introspection-core efdf9b1183dddfd4258cd181a72125755215ab7b (at node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x)
Format Binary           : prisma-fmt efdf9b1183dddfd4258cd181a72125755215ab7b (at node_modules/@prisma/engines/prisma-fmt-debian-openssl-1.1.x)
Default Engines Hash    : efdf9b1183dddfd4258cd181a72125755215ab7b
Studio                  : 0.459.0

还是一样的问题!

附带说明一下,如果代表为 1500 或更高的人可以添加 zod-prisma 标签,我将不胜感激。

缺少依赖项,只需安装 zod。

不过,生成器应该显示警告。

我还提交了一个 PR 来永久解决这个问题!