Module not found error after Sanity upgrade: Can't resolve '../../utils/patches
This looks like a classic case of mixed or corrupted dependencies after an upgrade. The @sanity/form-builder package was a standalone package in Sanity Studio v2, but it's been fully integrated into the core sanity package since Studio v3. This error usually means you have remnants of old packages in your node_modules.
Here's how to fix it:
1. Clean install (most likely solution):
rm -rf node_modules
rm package-lock.json # or yarn.lock / pnpm-lock.yaml
npm install2. Check your package.json:
Make sure you don't have @sanity/form-builder explicitly listed as a dependency. In Studio v3+, you should only have:
{
"dependencies": {
"sanity": "^3.x.x" // or whatever your version is
}
}If @sanity/form-builder is there, remove it and reinstall.
3. Check for outdated plugins:
Sometimes custom plugins or older third-party packages still depend on @sanity/form-builder. Run:
npm ls @sanity/form-builderIf anything shows up, those packages need updating to be compatible with Studio v3+.
4. Verify your Studio version:
- If you have a
sanity.jsonfile in your project root, you're still on Studio v2 and need to migrate to v3 - Make sure you're on Node.js 18+ (Node.js 20+ is required for Studio v4)
Why this happens:
The @sanity/form-builder package hasn't been maintained since Studio v3 was released. When upgrading, if the old package isn't fully removed, webpack/bundler tries to resolve the old internal file structure (like ../../utils/patches) which no longer exists. A clean install usually clears this up completely.
If you're still stuck after trying these steps, check if any custom input components in your schema are importing directly from @sanity/form-builder - those would need to be updated to import from sanity instead.
Show original thread15 replies
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.