Vercel "No Output Directory named 'dist' found" error with Sanity + NextJS
Error! No Output Directory named "dist" found after the Build completed. You can configure the Output Directory in your Project Settings.In this repo however
https://github.com/sanity-io/sanity-nextjs-vercel-example there also is no /dist folder and /dist is also ignored via .gitignore. I am know wondering if I should in fact run
sanity buildto generate an output folder or if there is another way.
Thank you in advance!
I can see what's happening here! This is a common confusion when setting up Sanity + Next.js on Vercel. The error you're seeing is related to Vercel's project configuration, not your actual project structure.
The issue is that Vercel is looking for a dist folder because it's been configured (or auto-detected) with the wrong build settings. When you deploy a Next.js application to Vercel, you should NOT be running sanity build as part of your deployment - that command is only for building a standalone Sanity Studio for self-hosting.
Solution: Update Your Vercel Project Settings
Go to your Vercel project settings (Project Settings → General → Build & Development Settings)
Set the correct Framework Preset: Select "Next.js" from the dropdown. This will automatically configure:
- Build Command:
next build(notsanity build) - Output Directory:
.next(notdist) - Install Command: Automatically detected
If you've manually set an Output Directory, remove it or change it to
.next
Why This Happens
sanity buildgenerates adistfolder containing a standalone Sanity Studionext buildgenerates a.nextfolder containing your Next.js application- The example repo you referenced has
.gitignoreentries for both because it may contain both a Next.js app AND an embedded Studio, but only the Next.js build is deployed to Vercel - When deploying a Next.js app with an embedded Studio (typically at
/studioroute), you only runnext build- Next.js handles bundling the Studio as part of your application
Quick Check
If your project structure looks like this:
/app or /pages (Next.js routes)
/sanity (Sanity schema/config)
next.config.js
sanity.config.tsThen you're building a Next.js app with embedded Studio, and you should use Next.js build settings on Vercel, not standalone Studio settings.
After updating these settings in Vercel, trigger a new deployment and it should build successfully!
Show original thread3 replies
Was this answer helpful?
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.


