
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeI understand you're facing a frustrating build issue after upgrading from Sanity v2 to v3. Even though your local build works fine and you've updated the Node version in your .nvmrc file, your production Netlify build is still failing because it's trying to access packages that no longer exist in v3 (like @sanity/core and @sanity/base).
This is a common migration issue. Here's what's happening and how to fix it:
In Sanity v3, several packages were deprecated and removed, including:
@sanity/base@sanity/core@sanity/default-layout@sanity/default-login@sanity/desk-toolThese packages have been consolidated into the single sanity package. If your build is still trying to import from these packages, it will fail.
package.jsonMake sure these packages are completely removed from your package.json dependencies:
// Remove these if they exist:
"@sanity/base"
"@sanity/core"
"@sanity/default-layout"
"@sanity/default-login"
"@sanity/desk-tool"Search your entire project for any imports from the old packages and update them. Common patterns to find and replace:
Old v2 imports:
import sanityClient from "part:@sanity/base/client"
import schema from 'part:@sanity/base/schema'
import userStore from "part:@sanity/base/user"New v3 imports:
import {useClient} from 'sanity'
import {useSchema} from 'sanity'
import {useCurrentUser} from 'sanity'Sometimes Netlify caches dependencies. Try:
Make sure your Netlify build command is using the v3 command. It should be:
npm run build
# or
sanity buildnode_modules Isn't CachedIf you have a node_modules directory committed to your repo (you shouldn't), remove it and add it to .gitignore.
Search your entire codebase (including config files) for these patterns:
part:@sanity/@sanity/base@sanity/coreCommon places these might hide:
sanity.config.js (should be updated from sanity.json)According to the Sanity v2 to v3 migration guide, you should:
sanity@latest"@sanity/ui": "^1""react": "^18.2.0""react-dom": "^18.2.0"sanity.json to sanity.config.jsimport X from "part:X" statementsTo identify exactly what's causing the issue:
If you're still stuck after trying these steps, please share:
package.json dependenciesThe Migration Cheat Sheet is also a great quick reference for common v2 to v3 code conversions!
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