Skip to content

Doc pointing to the wrong import path for Prisma Client #6794

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
SkyMarsh14 opened this issue Mar 29, 2025 · 2 comments · Fixed by #6815
Closed

Doc pointing to the wrong import path for Prisma Client #6794

SkyMarsh14 opened this issue Mar 29, 2025 · 2 comments · Fixed by #6815
Assignees
Labels
docs Documentation creation, updates or corrections priority: high Defines a high priority issue that we want to tackle right away

Comments

@SkyMarsh14
Copy link

SkyMarsh14 commented Mar 29, 2025

Bug description

Hello,

I was following this Prisma get started doc , and I've notice a thing here.
Although it says that I have to import with require('@prisma/client'), this results in the following error.

node:internal/modules/cjs/loader:1252
  throw err;
  ^

Error: Cannot find module '.prisma/client/default'
Require stack:
- /Users/skyaus/Downloads/hello-prisma/node_modules/@prisma/client/default.js
- /Users/skyaus/Downloads/hello-prisma/index.js

This is because, in the docs, it says that I should run the following command.
npx prisma init --datasource-provider postgresql --output ../generated/prisma
If i do this, it generates the module into ../generated/prisma instead of node_modules/@prisma/client/default.js
In fact, it correctly imports by importing with const { PrismaClient } = require("./generated/prisma/default");.

I think there should be an explanation with this in the docs.

Thanks for the consideration.

Expected vs. Actual Behavior

Expected not to throw module not found error.

Frequency

Consistently reproducible

Does this occur in development or production?

Only in development (e.g., CLI tools, migrations, Prisma Studio)

Is this a regression?

Workaround

Prisma Schema & Queries

// Add relevant schema.prisma snippet
// Add relevant Prisma Client query

Logs & Debug Info

// Debug logs here

Environment & Setup

  • OS: MacOs
  • Database: Postgresql
  • Node.js version: 22.11.0

Prisma Version

// Prisma version output
@sovetski
Copy link

sovetski commented Apr 2, 2025

Same here, the docs should be updated because for now it is very confusing

@FGoessler FGoessler transferred this issue from prisma/prisma Apr 3, 2025
@FGoessler FGoessler added docs Documentation creation, updates or corrections priority: high Defines a high priority issue that we want to tackle right away labels Apr 3, 2025
@mhessdev
Copy link
Contributor

mhessdev commented Apr 7, 2025

Thanks for brining this to our attention! We will get this sorted ASAP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation creation, updates or corrections priority: high Defines a high priority issue that we want to tackle right away
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants