【问题标题】:prisma-select issue for custom output path自定义输出路径的棱镜选择问题
【发布时间】:2021-08-06 15:59:18
【问题描述】:

当我尝试使用时出现以下错误

const select = new PrismaSelect(info).value;

[Nest] 65877 - 17/05/2021, 16:45:13 [ExceptionsHandler] 找不到模块 '.prisma/client'

我的 PrismaClient 位于自定义路径而不是默认路径中,因为我正在为多个微服务使用 monorepo。

generator client {
    provider      = "prisma-client-js"
    binaryTargets = ["native", "darwin"]
    output        = "../src/.generated/prisma/client"
}

有没有办法将 PrismaSelect 指向正确的客户端?

【问题讨论】:

    标签: microservices nestjs prisma monorepo nrwl-nx


    【解决方案1】:

    解决方案由包作者分享

    导入 Prisma Client 的自定义实例

    import { Prisma } from '../../.generated/prisma/client';
    

    将 dmmf 对象传递给 PrismaSelect 构造函数

    const select = new PrismaSelect(info, { dmmf: [Prisma.dmmf] }).value;
    

    【讨论】:

      猜你喜欢
      • 2017-01-31
      • 2011-09-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-20
      • 2020-09-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多