执行prisma deploy报错:Cluster undefined does not exist 求助
prisma deploy Hey there, I’ve run into this exact issue before when working with Prisma—let’s get you past this error so you can keep moving with your GraphQL tutorial!
First, let’s recap your situation to make sure I’m on the same page:
You’re following a React-Apollo GraphQL tutorial, installed Prisma globally with
npm install -g prisma, and when runningprisma deployin your server directory, you hit this error:Error: Cluster undefined does not exist. at Deploy.<anonymous> (/usr/local/lib/node_modules/prisma/node_modules/prisma-cli-core/src/commands/deploy/index.ts:175:13) ...
This error almost always boils down to Prisma not having a valid cluster configured in your prisma.yml file. Here’s how to fix it step by step:
1. Verify your prisma.yml configuration
Head to your server/database/prisma.yml file and make sure it includes a cluster field that matches your setup:
- If you’re using a local Prisma server (running via Docker), your config should look something like this:
endpoint: http://localhost:4466/hackernews-react-apollo/dev cluster: local datamodel: datamodel.prisma - If you’re using a Prisma Cloud cluster, replace
localwith the name of your cluster (you can find this in your Prisma Cloud dashboard).
The key here is that the cluster field can’t be missing or set to undefined—that’s exactly what’s causing the error.
2. Ensure your Prisma cluster is accessible
- For local clusters: Check if your Docker container is running by running
docker ps. If you don’t see aprisma/prismacontainer listed, start it withdocker-compose up -d(assuming you have adocker-compose.ymlin your server directory). - For cloud clusters: Run
prisma loginin your terminal to re-authenticate, then make sure you select the correct cluster when prompted.
3. Re-initialize Prisma (if needed)
If your prisma.yml looks correct but you’re still getting the error, try re-initializing the Prisma setup in your database directory:
- Navigate to
server/database - Run
prisma init - Follow the prompts to select your cluster (local or cloud)
- Once the new
prisma.ymlis generated, runprisma deployagain
This should overwrite any misconfigured settings and get you up and running.
Let me know if any of these steps resolve your issue—happy to help if you hit any other snags!
内容的提问来源于stack exchange,提问作者aravind_reddy

