Open GestHairHome opened 3 months ago
I have the same problem.
If you change the output path in your schema ...
generator client { provider = "prisma-client-js" output = "../../../node_modules/.prisma/client/one" }
and adjust the import for the client ...
import { PrismaClient } from '.prisma/client/one';
... it works. Seems like the files have to be in "node_modules/.prisma/...". Otherwise it can not be imported in the dist/apps/
module.exports = require("@prisma/client/one"); // Won't work
I do not know if that is an optimal solution :( I would still like to use "@prisma/..." for generation and import.
After cloning and instal, I ran the following command with the result: gesthairhome@mbp-de-patrick nestjs-prisma % cp .env.example .env gesthairhome@mbp-de-patrick nestjs-prisma % nx run-many -t migrate
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
gesthairhome@mbp-de-patrick nestjs-prisma % nx serve api
chunk (runtime: main) main.js (main) 23.5 KiB [entry] [rendered] webpack compiled successfully (43048f463d3f7801) Debugger listening on ws://localhost:9229/e3c18e9b-1bc0-40ce-b1d5-76f419c3029c Debugger listening on ws://localhost:9229/e3c18e9b-1bc0-40ce-b1d5-76f419c3029c For help, see: https://nodejs.org/en/docs/inspector
Error: Cannot find module '/Users/gesthairhome/Applis/nx-recipes/nestjs-prisma/node_modules/@prisma/client/one' at createEsmNotFoundErr (node:internal/modules/cjs/loader:1181:15) at finalizeEsmResolution (node:internal/modules/cjs/loader:1169:15) at resolveExports (node:internal/modules/cjs/loader:591:14) at Function.Module._findPath (node:internal/modules/cjs/loader:668:31) at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1130:27) at Function.Module._load (node:internal/modules/cjs/loader:985:27) at Function.Module._load (/Users/gesthairhome/Applis/nx-recipes/nestjs-prisma/nodemodules/.pnpm/@nx+js@17.1.3@types+node@18.7.23_nx@17.1.3_typescript@5.2.2/node_modules/@nx/js/src/executors/node/node-with-require-overrides.js:18:31) at Module.require (node:internal/modules/cjs/loader:1235:19) at require (node:internal/modules/helpers:176:18) at Array.Object.defineProperty.value (/Users/gesthairhome/Applis/nx-recipes/nestjs-prisma/dist/apps/api/webpack:/external commonjs "@prisma/client/one":1:1)
I have check directory '/Users/gesthairhome/Applis/nx-recipes/nestjs-prisma/node_modules/@prisma/client/one' exist