Skip to content

Module not found error when working with hello-prisma #6796

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

Open
RushilJalal opened this issue Apr 4, 2025 · 1 comment
Open

Module not found error when working with hello-prisma #6796

RushilJalal opened this issue Apr 4, 2025 · 1 comment
Labels
docs Documentation creation, updates or corrections

Comments

@RushilJalal
Copy link

RushilJalal commented Apr 4, 2025

I was following this tutorial in creating hello-prisma in https://www.prisma.io/docs/getting-started/setup-prisma/start-from-scratch/relational-databases-typescript-prismaPostgres?utm_source=cli&utm_medium=promo-generate-v5-17&utm_campaign=--optimize

On running node index.js, I was met with the error message MODULE_NOT_FOUND. Full error log below.

What fixed the issue for me:

Remove the output field(comment out) from generator client in schema.prisma and rerun npx generate prisma

generator client {
  provider = "prisma-client-js"
  // output   = "../generated/prisma"
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

Full error logs:

rushil@Rushil:~/code/hello-prisma$ node index.js
node:internal/modules/cjs/loader:1252
  throw err;
  ^

Error: Cannot find module '.prisma/client/default'
Require stack:
- /home/rushil/code/hello-prisma/node_modules/@prisma/client/default.js
- /home/rushil/code/hello-prisma/index.js
    at Function._resolveFilename (node:internal/modules/cjs/loader:1249:15)
    at Function._load (node:internal/modules/cjs/loader:1075:27)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:219:24)
    at Module.require (node:internal/modules/cjs/loader:1340:12)
    at require (node:internal/modules/helpers:138:16)
    at Object.<anonymous> (/home/rushil/code/hello-prisma/node_modules/@prisma/client/default.js:2:6)
    at Module._compile (node:internal/modules/cjs/loader:1565:14)
    at Object..js (node:internal/modules/cjs/loader:1708:10)
    at Module.load (node:internal/modules/cjs/loader:1318:32) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/rushil/code/hello-prisma/node_modules/@prisma/client/default.js',
    '/home/rushil/code/hello-prisma/index.js'
  ]
}

Node.js v22.12.0
@RushilJalal RushilJalal added the docs Documentation creation, updates or corrections label Apr 4, 2025
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
Projects
None yet
Development

No branches or pull requests

1 participant