
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeThis is a known issue with @sanity/cli version 3.35.2 that's related to a styled-components peer dependency problem. The error occurs because version 3.35.2 introduced a requirement for styled-components v6, but your project likely has an older version installed or the dependencies weren't properly resolved during the update.
Based on the community discussion, here's how to fix it:
Update styled-components to version 6 in your package.json:
"styled-components": "^6"Clean install your dependencies:
# Delete your lock file and node_modules
rm package-lock.json
rm -rf node_modules
# Reinstall everything
npm installThe key here is doing a fresh npm install rather than npm update. Simply updating won't properly resolve the peer dependency tree, which is why you're seeing the "Cannot read properties of undefined (reading 'div')" error - @sanity/ui is trying to use styled-components methods that aren't available in older versions.
The @sanity/cli 3.35.2 release updated its dependency on @sanity/ui, which in turn requires styled-components v6. If you had v5 installed, the package wasn't compatible, causing the bundled UI components to fail when trying to access styled-components' API.
If you're still experiencing issues after the clean install, you could temporarily downgrade to @sanity/cli 3.35.1 until you're ready to update all dependencies, though upgrading styled-components is the recommended long-term fix. The issue was resolved in subsequent CLI releases, so you might also consider updating to a newer version of @sanity/cli (3.35.3 or later) which should handle the styled-components dependency more gracefully.
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