question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Prisma generate > unlink index.d.ts

See original GitHub issue

Bug description

When trying to generate the client on my product server I get this issue: EACCES: permission denied, unlink ‘/srv/PROJET_NAME/api/node_modules/.prisma/client/index.d.ts’

Prisma migrate has worked just fined I’ve tried to uninstall prisma + prisma/client but nothing has changed.

USERNAME@server:/srv/PROJET_NAME/api$ npx prisma generate
  prisma:engines binaries to download libquery-engine, migration-engine, introspection-engine, prisma-fmt +0ms
  prisma:loadEnv project root found at /srv/PROJET_NAME/api/package.json +0ms
  prisma:tryLoadEnv Environment variables loaded from /srv/PROJET_NAME/api/.env +0ms
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
  prisma:getConfig Using CLI Query Engine (Node-API Library) at: /srv/PROJET_NAME/api/node_modules/prisma/libquery_engine-debian-openssl-1.1.x.so.node +0ms
  prisma:getDMMF Using CLI Query Engine (Node-API) at: /srv/PROJET_NAME/api/node_modules/prisma/libquery_engine-debian-openssl-1.1.x.so.node +0ms
  prisma:generator prismaCLIDir /srv/PROJET_NAME/api/node_modules/prisma +0ms
  prisma:generator prismaClientDir /srv/PROJET_NAME/api/node_modules/@prisma/client +0ms
  prisma:generator baseDir /srv/PROJET_NAME/api/prisma +1ms
  prisma:generator typescriptPath undefined +3ms
  prisma:GeneratorProcess 2022-02-02T21:38:51.259Z prisma:client:generator requiredEngine: libqueryEngine +0ms
  prisma:getGenerators neededVersions {
  "bcc2ff906db47790ee902e7bbc76d7ffb1893009": {
    "engines": [
      "libqueryEngine"
    ],
    "binaryTargets": []
  }
} +0ms
  prisma:getGenerators {
  prisma:getGenerators   generatorBinaryPaths: {
  prisma:getGenerators     libqueryEngine: {
  prisma:getGenerators       'debian-openssl-1.1.x': '/srv/PROJET_NAME/api/node_modules/prisma/libquery_engine-debian-openssl-1.1.x.so.node'
  prisma:getGenerators     }
  prisma:getGenerators   }
  prisma:getGenerators } +306ms
  prisma:GeneratorProcess 2022-02-02T21:38:51.970Z prisma:loadEnv project root found at /srv/PROJET_NAME/api/package.json +709ms
  prisma:tryLoadEnv Environment variables loaded from /srv/PROJET_NAME/api/.env +0ms
Error: Error: 
Error: EACCES: permission denied, unlink '/srv/PROJET_NAME/api/node_modules/.prisma/client/index.d.ts'


    at Object.parse (/srv/PROJET_NAME/api/node_modules/prisma/build/index.js:105342:15)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async main (/srv/PROJET_NAME/api/node_modules/prisma/build/index.js:106752:18)
USERNAME@server:/srv/PROJET_NAME/api$ 

fyi, I’ve prisma installed on another project on the same server and it works fine

How to reproduce

  1. Run npx prisma generate

Expected behavior

Generate the client

Prisma information

I’ve been able to migrate the schema without any issue

Environment & setup

  • OS: Ubuntu 16.04.7 LTS
  • Database: 5.7.34
  • Node.js version: v16.6.2

Prisma Version

prisma                  : 3.9.1
@prisma/client          : 3.9.1
Current platform        : debian-openssl-1.1.x
Query Engine (Node-API) : libquery-engine bcc2ff906db47790ee902e7bbc76d7ffb1893009 (at node_modules/@prisma/engines/libquery_engine-debian-openssl-1.1.x.so.node)
Migration Engine        : migration-engine-cli bcc2ff906db47790ee902e7bbc76d7ffb1893009 (at node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x)
Introspection Engine    : introspection-core bcc2ff906db47790ee902e7bbc76d7ffb1893009 (at node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x)
Format Binary           : prisma-fmt bcc2ff906db47790ee902e7bbc76d7ffb1893009 (at node_modules/@prisma/engines/prisma-fmt-debian-openssl-1.1.x)
Default Engines Hash    : bcc2ff906db47790ee902e7bbc76d7ffb1893009
Studio                  : 0.457.0

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
hubsmokecommented, May 21, 2022

@luminous8 If you’re using Docker take a look if you’re mounting a volume for node_modules. If you’re also using WSL, could be related to how permissions work in that environment vs the Docker container. I had this problem while using Docker, and the chmod OR simply not mounting a volume fixed it.

0reactions
tmp-friendscommented, Aug 17, 2022

@luminous8 I was facing a similar error in WSL2 + Docker: EACCES: permission denied, unlink ‘/app/backend/node_modules/.prisma/client/index.js’

In my case, it was because /node_modules/.prisma/client/index.js was created in a container and can only be run as root user.

As a solution.

  1. grant execute permission to the file -> chmod 777 /node_modules/.prisma/client/index.js
  2. change user and group permission from root to node in the schema.prisma -> chown node:node /node_modules/.prisma/client/schema.prisma
Read more comments on GitHub >

github_iconTop Results From Across the Web

Prisma Client API (Reference)
Returns all records where related record matches filtering criteria (for example, user's name isNot Bob). Reference. index.d.ts.
Read more >
Error when generating prisma: -- EACCES: permission denied ...
It seems like a permission error. You could fix it by changing the ownership of the node_modules/. prisma folder from the root to...
Read more >
Prisma | NestJS - A progressive Node.js framework
Prisma is an open-source ORM for Node.js and TypeScript. ... Inside the src directory, create a new file called prisma.service.ts and add the...
Read more >
Prisma 4.7.0 Release - GitClear
fix(client): remove retries for all errors except network ... interactive transaction with a Serializable isolation level: ts await prisma.
Read more >
prisma not null schema | The search engine you control.
Prisma schema and generated SQL files below: ... So i accessed the index.d.ts that's located at node_modules\.prisma\client\index.d.ts to see the type ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found