
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeBased on your error, this is a classic monorepo dependency resolution issue when deploying to Vercel. The problem is that Vercel's build process can't find react-icons even though it's listed in your sanity/package.json, because of how monorepos handle dependency hoisting and module resolution.
Here are the most common solutions:
In your Vercel project settings (or vercel.json), you need to tell Vercel:
If your Next.js app is in a subdirectory, set the Root Directory in Vercel to point to it, but keep the Install Command running from the monorepo root. For example:
{
"buildCommand": "cd apps/web && npm run build",
"installCommand": "npm install"
}With Lerna, dependencies might not be hoisted correctly. Make sure your root package.json has the proper workspace configuration. If using npm/yarn workspaces:
{
"workspaces": [
"sanity",
"web"
]
}Sometimes the quickest fix is to install react-icons in both:
sanity/package.json (which you already have)package.jsonpackage.jsonThis ensures it's available regardless of how the build process resolves modules.
Since the error mentions /sanity/schemas, check if you're importing icons in your schema files. If your Next.js build is trying to bundle Sanity schemas (perhaps for type generation or live previews), it needs access to those dependencies. You might need to adjust your Next.js webpack config or ensure the Sanity workspace dependencies are available during the Next.js build.
As mentioned in the Sanity monorepo documentation, PNPM workspaces have become the popular standard for monorepo management with Sanity projects. PNPM handles dependency resolution more predictably than Lerna in many cases. Consider migrating if the issue persists.
Looking at the nextjs-ecommerce-starter that works for you, compare:
package.json filesThe key is ensuring Vercel's build process can resolve dependencies across your workspace during the build phase. The error suggests the Next.js build is trying to process your Sanity schema files but can't find their dependencies in the expected location.
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.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store