DEV Community

Cover image for Deploying Express + TypeScript + Prisma to Render: What Went Wrong (and How I Fixed It)
Chloe Zhou
Chloe Zhou

Posted on

Deploying Express + TypeScript + Prisma to Render: What Went Wrong (and How I Fixed It)

Originally published on Medium.

When I deployed my Express + TypeScript + Prisma backend to Render, I didn’t expect to spend an entire afternoon chasing down one error after another — but that’s exactly what happened. This post is a personal log of all the unexpected problems I hit, what they actually meant, and what I did to get things working again.

I’m writing this down in case someone else (or future me) runs into the same stack of issues and needs a sanity check.


🔴 Error 1: process and console not found in TypeScript

💥 What was the error?

During the build, I saw this in the logs:

Cannot find name ‘process’.
Cannot find name ‘console’.
Enter fullscreen mode Exit fullscreen mode

TypeScript didn’t seem to recognize basic Node.js globals. I thought this was weird — these should be available by default, right?

🧪 What I tried

I added the following to my tsconfig.json:

{
  "compilerOptions": {
    "types": ["node"]
  }
}
Enter fullscreen mode Exit fullscreen mode

…only to be greeted with:

Cannot find type definition file for 'node'
Enter fullscreen mode Exit fullscreen mode

I had @types/node installed — but it was under devDependencies.

✅ What actually fixed it

Turns out Render doesn’t install devDependencies during production builds by default. Once I moved @types/node to dependencies, the build succeeded.

npm install @types/node --save
Enter fullscreen mode Exit fullscreen mode

✔️ Lesson learned: If your app builds before running (like most TypeScript setups), your build-time tools and types must be in dependencies, not devDependencies.

🔴 Error 2: Cannot find index.js on Render

💥 What was the error?

Another build, another facepalm:

Error: Cannot find module '/opt/render/project/src/index.js'
Enter fullscreen mode Exit fullscreen mode

Render was trying to start my app using node index.js, but my compiled code lived in dist/index.js.

🧪 What I tried

I updated package.json:

{
  "main": "dist/index.js",
  "scripts": {
    "build": "tsc",
    "start": "node dist/index.js"
  }
}
Enter fullscreen mode Exit fullscreen mode

Still didn’t work.

✅ What actually fixed it

Render’s Start Command was still set to node index.js in the Dashboard.

Once I changed it to:

npm start
Enter fullscreen mode Exit fullscreen mode

…everything clicked into place.

✔️ Lesson learned: Your local scripts don’t override what Render runs. Double-check the Start Command and Build Command fields in the Render Dashboard.

🔴 Error 3: @prisma/client did not initialize

💥 What was the error?

@prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
Enter fullscreen mode Exit fullscreen mode

At this point, I wasn’t even surprised anymore.

🧪 What I tried

I checked my build script. It was just:

"build": "tsc"
Enter fullscreen mode Exit fullscreen mode

…but Prisma Client needs to be generated before TypeScript compiles the code that imports it. Oops.

Also, I noticed my schema.prisma had a custom output path like this:

generator client {
  provider = "prisma-client-js"
  output   = "../src/generated/prisma"
}
Enter fullscreen mode Exit fullscreen mode

✅ What actually fixed it

I updated the Prisma generator config to use the default output path (which lives inside node_modules/.prisma/client):

generator client {
  provider = "prisma-client-js"
  output   = "../node_modules/.prisma/client"
}
Enter fullscreen mode Exit fullscreen mode

I updated the build script to ensure Prisma Client gets generated before compilation:

"build": "prisma generate --no-engine && tsc"
Enter fullscreen mode Exit fullscreen mode

I also updated the import to:

import { PrismaClient } from '@prisma/client';
Enter fullscreen mode Exit fullscreen mode

✔️ Lesson learned: Prisma Client must be generated before compilation. Also, using the default output path avoids a lot of edge cases — especially when deploying.

✅ Final Checklist (So I Don’t Forget Again)

Here’s a checklist of everything I ended up fixing:

  • Move @types/node from devDependenciesdependencies
  • Use start: node dist/index.js in scripts
  • Set Build Command to npm run build on Render
  • Set Start Command to npm start on Render
  • Use prisma generate before tsc in your build step
  • Avoid customizing Prisma output unless you have to — use the default node_modules/.prisma/client
  • Use --no-engine with prisma generate if you’re deploying or using Prisma Accelerate

One last thing

If you’re here because your Render build failed with some weird Prisma or TypeScript error — you’re not alone. It’s usually something small, just hiding in plain sight.

Hope this helps someone else. If you’ve run into other gotchas with this stack, feel free to share — I’d be happy to learn from your debugging too.

🛠 Tech Stack / Environment

  • Node.js: 18.20.5
  • Express: 5.1.0
  • TypeScript: 5.8.3
  • Prisma: 6.6.0
  • @prisma/client: 6.6.0
  • ts-node: 10.9.2
  • Render deployment: May 2025

Warp.dev image

Warp is the highest-rated coding agent—proven by benchmarks.

Warp outperforms every other coding agent on the market, and gives you full control over which model you use. Get started now for free, or upgrade and unlock 2.5x AI credits on Warp's paid plans.

Download Warp

Top comments (0)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.