After tinkering a bit with a new Keystone 6 project, the npm run dev command started failing with the following error:
Error: EPERM: operation not permitted, rename 'C:\Users\...\node_modules\.prisma\client\query_engine-windows.dll.node.tmp34132' -> 'C:\Users\...\node_modules\.prisma\client\query_engine-windows.dll.node'
at async Object.rename (node:internal/fs/promises:782:10)
at async overwriteFile (C:\Users\...\node_modules\@prisma\client\generator-build\index.js:4477:5)
at async generateClient (C:\Users\...\node_modules\@prisma\client\generator-build\index.js:10035:7)
at async LineStream.<anonymous> (C:\Users\...\node_modules\@prisma\client\generator-build\index.js:4380:24
It looks like this happens if I import ".prisma/client" in keystone.ts (I wanted to export a context object to be used by a frontend app). It also seems to make starting the dev server quite a lot slower.
This error does not happen if I run the project within WSL.
- Node v24.13.1
- NPM 11.8.0
- @keystone-6/auth 8.1.0
- @keystone-6/core 6.5.1
I fixed it by putting the code to build and export the context object in its own file but the error stumped me for quite a while. Maybe you could detect it ahead of time and warn users to not do that?
After tinkering a bit with a new Keystone 6 project, the
npm run devcommand started failing with the following error:It looks like this happens if I
import ".prisma/client"inkeystone.ts(I wanted to export acontextobject to be used by a frontend app). It also seems to make starting the dev server quite a lot slower.This error does not happen if I run the project within WSL.
I fixed it by putting the code to build and export the
contextobject in its own file but the error stumped me for quite a while. Maybe you could detect it ahead of time and warn users to not do that?