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

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:

```plaintext
Cannot find name ‘process’.
Cannot find name ‘console’.
```

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`:

```json
{
  "compilerOptions": {
    "types": ["node"]
  }
}
```

…only to be greeted with:

```plaintext
Cannot find type definition file for 'node'
```

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.

```plaintext
npm install @types/node --save
```

✔️ **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:

```plaintext
Error: Cannot find module '/opt/render/project/src/index.js'
```

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`:

```plaintext
{
  "main": "dist/index.js",
  "scripts": {
    "build": "tsc",
    "start": "node dist/index.js"
  }
}
```

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:

```plaintext
npm start
```

…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?

```plaintext
@prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
```

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

#### 🧪 What I tried

I checked my build script. It was just:

```plaintext
"build": "tsc"
```

…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:

```plaintext
generator client {
  provider = "prisma-client-js"
  output   = "../src/generated/prisma"
}
```

#### ✅ What actually fixed it

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

```plaintext
generator client {
  provider = "prisma-client-js"
  output   = "../node_modules/.prisma/client"
}
```

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

```plaintext
"build": "prisma generate --no-engine && tsc"
```

I also updated the import to:

```plaintext
import { PrismaClient } from '@prisma/client';
```

✔️ **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 `devDependencies` → `dependencies`
    
*   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 love to hear what tripped you up too — drop it in the comments.

---

🛠 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
