Prisma Rename Error When Running Backend Before Frontend in Remix Shopify App

I’m building a Shopify app using Remix, Prisma, and a custom Express backend. I’m facing a strange error when I run the backend first and then the frontend.

Error:

Error:
EPERM: operation not permitted, rename ‘D:\Age Verification\age-verification\node_modules.prisma\client\query_engine-windows.dll.node.tmp29084’ →
‘D:\Age Verification\age-verification\node_modules.prisma\client\query_engine-windows.dll.node’

Environment variables loaded from .env
Prisma schema loaded from prisma\schema.prisma

What Works:

If I run the frontend first using: shopify app dev

…and then run the backend using: npm run server

Everything works perfectly.

What Fails:

If I reverse the order and start backend first (npm run server) and then run shopify app dev, I get the above Prisma rename EPERM error.

My Setup:- Backend: Express + Prisma

  • Frontend: Remix + Shopify CLI

  • OS: Windows

  • Prisma version: 5.x

Node version: 18.x

package.json Scripts:

“scripts”: {
“build”: “remix vite:build”,
“start”: “node server.js”,
“dev”: “remix dev”,
“server”: “nodemon server.js”,
“predev”: “prisma generate && prisma db push”,
“setup”: “prisma generate && prisma db push”,

}

Questions:- Why does this error only occur when I run the backend before the Shopify CLI?

  • Is this a Prisma-specific issue with how .prisma/client gets initialized, or does the Shopify CLI interfere?

  • What’s the best practice to run both the frontend and backend concurrently in this setup?

Any insights would be appreciated :folded_hands: