Structured Content 2022: Join our conference to explore fresh perspectives on content and digital experiences →

I get this error when trying to run a Sanity Studio ```Uncaught TypeError: Cannot read property 'sanity' of undefined```

11 replies
Last updated: Jan 12, 2021

I get this error when trying to run a Sanity Studio

Uncaught TypeError: Cannot read property 'sanity' of undefined

Jan 12, 2021, 11:30 PM

Did you run

npm install -g @sanity/cli

Jan 12, 2021, 11:31 PM

yes

Jan 12, 2021, 11:31 PM

i have other studios that work

Jan 12, 2021, 11:31 PM

Does the fix suggested at the end here work?
https://github.com/sanity-io/sanity/issues/2190

Jan 12, 2021, 11:33 PM

Trying to hook this repo up and Ive done it before but now Im getting this error. I was hoping someone had insight.

Jan 12, 2021, 11:33 PM

i tried that fix, deleting node_modules?

Jan 12, 2021, 11:33 PM

ah, package-lock.json Ill try it now

Jan 12, 2021, 11:34 PM

deleting package-lock.json. Otherwise it might be worth running

sanity upgrade

Jan 12, 2021, 11:34 PM

that worked thank you

Jan 12, 2021, 11:37 PM

i totally glossed over the package-lock part

Jan 12, 2021, 11:37 PM

Sanity.io: Get the most out of your content

Sanity.io is a platform to build websites and applications. It comes with great APIs that let you treat content like data. Give your team exactly what they need to edit and publish their content with the customizable Sanity Studio. Get real-time collaboration out of the box. Sanity.io comes with a hosted datastore for JSON documents, query languages like GROQ and GraphQL, CDNs, on-demand asset transformations, presentation agnostic rich text, plugins, and much more.

Don't compromise on developer experience. Join thousands of developers and trusted companies and power your content with Sanity.io. Free to get started, pay-as-you-go on all plans.