👀 Our most exciting product launch yet 🚀 Join us May 8th for Sanity Connect

Error reading sanity/cli after updating to version 3.35.2

12 replies
Last updated: Mar 26, 2024
Hi there!
I run into this error once I’ve updated the sanity/cli from 3.35.1 to 3.35.2:

> Error reading “/Users/xxxx/xxxx/studio/sanity.cli.ts”: Cannot read properties of undefined (reading ‘div’)
> TypeError: Cannot read properties of undefined (reading ‘div’)
> at Object.
anonymous (/Users/xxxx/neww/xxxx/node_modules/@sanity/ui/dist/index.js:1235:40)
Mar 25, 2024, 3:58 PM
having same issue here
user D
Mar 25, 2024, 4:50 PM
Right! I’ll let you know if I’ve found a solution!
Mar 25, 2024, 5:10 PM
I believe this is a
styled-components
issue that’s being fixed in the next release. Can you try manually installing that package?
Mar 25, 2024, 5:49 PM
I’ve just done that, and now I get another error

Error reading “/xxxx/xxxxx/neww/studio/sanity.cli.ts”: avatarStyle is not defined
ReferenceError: avatarStyle is not defined
at Object.<anonymous> (/Users/damonchan/neww/studio/node_modules/@sanity/ui/dist/index.js3)
Mar 25, 2024, 6:10 PM
What does your sanity.cli file look like?
Mar 25, 2024, 6:11 PM
Also is your styled components set to:
"styled-components": "^6"
Mar 25, 2024, 6:17 PM
Yes, I’ve done that!
This is my sanity.cli:

> import {defineCliConfig} from ‘sanity/cli’
> import {projectId, dataset} from ‘./sanity.config’
>
> export default defineCliConfig({
> api: {
> projectId,
> dataset,
> },
> })
Mar 25, 2024, 7:17 PM
Hmmm, ok, double check that you’ve set styled components to
^6
in your
package.json
, delete your
package-lock
and
node_modules
, the run
npm i
to see if that gets it working.
Mar 25, 2024, 7:20 PM
Ah! It works!
Mar 25, 2024, 7:23 PM
Thx! I’ve tried the same thing but I did npm update instead….npm i does the trick
Mar 25, 2024, 7:24 PM
Excellent!
Mar 25, 2024, 7:25 PM
user Q
^
Mar 26, 2024, 9:14 AM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?