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

Vercel build failing: react-hook-form import error after Next 13.4.8

3 repliesLast updated: Nov 29, 2025

This morning I deployed a couple of changes to vercel and the build process worked. I made one small change (added an icon) and then re-committed. All of my builds are failing now with the error:
Failed to compile.
./node_modules/@hookform/resolvers/dist/resolvers.mjs
Attempted import error: 'set' is not exported from 'react-hook-form' (imported as 'i')
Import trace for requested module:
./node_modules/@hookform/resolvers/dist/resolvers.mjs
/node_modules/@hookform/resolvers/yup/dist/yup.mjs
/node_modules/sanity-plugin-media/lib/index.esm.js
/sanity.config.js
/app/(admin)/studio/[[...index]]/page.js

I am running Sanity Studio from the App directory.

Current version of next-sanity is 5.1.0

The failed builds coincide with the exact time that Next v13.4.8 was released.

Any suggestions other than starting from scratch again with the implementation of Studio? Anybody else experiencing this?
AI Update

This is a classic dependency version conflict issue between sanity-plugin-media and react-hook-form. The error occurs because @hookform/resolvers (used by the media plugin) is trying to import a set function that doesn't exist in older versions of react-hook-form.

The timing with Next.js 13.4.8's release is likely coincidental - what probably happened is that your lockfile got regenerated during the build, pulling in newer versions of dependencies that are incompatible with each other.

Here's how to fix it:

npm install react-hook-form@latest
npm install @hookform/resolvers@latest
rm -rf node_modules package-lock.json
npm install

Why this happened: The sanity-plugin-media package has specific peer dependency requirements. When your build process ran, it likely resolved to incompatible versions of react-hook-form and @hookform/resolvers. The set utility was added to react-hook-form in v7.43.0, but older versions don't have it.

For Vercel specifically: Make sure to clear Vercel's build cache after updating your dependencies. You can do this in your project settings under "Deployments" → click the three dots menu → "Redeploy" with "Use existing Build Cache" unchecked.

You definitely don't need to start from scratch - this is purely a dependency version mismatch that can be resolved by aligning your package versions.

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