Joint session with Vercel: How to build intelligent storefronts (May 15th)

Vercel "No Output Directory named 'dist' found" error with Sanity + NextJS

3 repliesLast updated: Nov 29, 2025

I'm trying to setup Sanity + NextJS with Vercel. I've read the tutorial and I am able to deploy, however, in the Vercel build step, I run into an error stating
Error! No Output Directory named "dist" found after the Build completed. You can configure the Output Directory in your Project Settings.
and the build fails.

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 build
to generate an output folder or if there is another way.
Thank you in advance!
AI Update

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

Why This Happens

Quick Check

If your project structure looks like this:

/app or /pages  (Next.js routes)
/sanity         (Sanity schema/config)
next.config.js
sanity.config.ts

Then 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 thread
3 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.

Related contributions