Skip to content
Latchkey

Prisma "prisma generate" EACCES permission denied in CI

prisma generate writes the client into node_modules/.prisma/client. If that path is owned by another user or mounted read-only, generation fails with EACCES before the client is written.

What this error means

prisma generate stops with "EACCES: permission denied, mkdir" or "open ... node_modules/.prisma/client", often inside a container where node_modules was created by root.

Prisma
Error: EACCES: permission denied, open '/app/node_modules/.prisma/client/query_engine-...'
    at Object.openSync (node:fs:...)

Common causes

node_modules owned by a different user

A container installed dependencies as root, then the job runs as a non-root user that cannot write into the generated client directory.

A read-only mounted node_modules

A volume or cache mount makes node_modules read-only, so generate cannot create the client output.

How to fix it

Fix ownership before generating

Ensure the user running generate owns node_modules, or run generate as the same user that installed.

Terminal
chown -R "$(id -u):$(id -g)" node_modules
npx prisma generate

Generate to a writable output path

Point the generator output at a directory the CI user can write, then import from it.

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

How to prevent it

  • Install and generate as the same user inside CI containers.
  • Avoid read-only mounts over node_modules when generation must run.
  • Set a writable generator output when the default is not writable.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →