question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sanity Studio won't start – Cannot read property 'sanity' of undefined

See original GitHub issue

NOTE: I am getting the same symptoms as this issue (link below), but supposedly it was resolved and to do with factors that don’t seem to apply to my case, from what I can tell. I updated all packages to current versions immediately before the issue started. https://github.com/sanity-io/sanity/issues/2190

Describe the bug

When starting Sanity, after installing the latest versions of all packages as per today (see full list below) I am getting the following error:

Cannot read property 'sanity' of undefined

The error (as in the issue linked to above) seems to be in GlobalStyle.js, L20: var color = theme.sanity.color.base;

Stack:
TypeError: 
    at http://localhost:3333/static/js/app.bundle.js:342103:21
    at Ne (http://localhost:3333/static/js/app.bundle.js:71079:14925)
    at Ne (http://localhost:3333/static/js/app.bundle.js:71079:14698)
    at e.t.createStyles (http://localhost:3333/static/js/app.bundle.js:71079:23087)
    at e.t.renderStyles (http://localhost:3333/static/js/app.bundle.js:71079:23326)
    at h (http://localhost:3333/static/js/app.bundle.js:71079:24669)
    at http://localhost:3333/static/js/app.bundle.js:71079:24485
    at commitHookEffectListMount (http://localhost:3333/static/js/vendor.bundle.js:22889:26)
    at commitLifeCycles (http://localhost:3333/static/js/vendor.bundle.js:22945:9)
    at commitLayoutEffects (http://localhost:3333/static/js/vendor.bundle.js:25961:7)

To Reproduce

Steps to reproduce the behavior:

Install the versions listed below and start sanity.

Expected behavior

Sanity starting without issues.

Which versions of Sanity are you using?

These are the dependencies from my package.json:

    "@sanity/base": "^2.10.0",
    "@sanity/components": "^2.2.6",
    "@sanity/core": "^2.10.0",
    "@sanity/default-layout": "^2.10.0",
    "@sanity/default-login": "^2.8.0",
    "@sanity/desk-tool": "^2.10.0",
    "@sanity/google-maps-input": "^2.10.0",
    "@sanity/structure": "^2.10.0",
    "@sanity/vision": "^2.10.0",
    "prop-types": "^15.7",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-icons": "^4.2.0"

What operating system are you using?

MacOS Sierra

Which versions of Node.js / npm are you running?

6.14.11 v14.16.0

Additional context

The issue linked to above mentioned a problem to do with conflicting dependencies to Styled Components. I don’t seem to be able to detect that issue in my setup.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
bjoergecommented, Apr 30, 2021

I suspect this relates to sanity upgrade using yarn to install dependencies. Could you try removing node_modules and running npm install again?

2reactions
damkycommented, Apr 29, 2021

I’m getting a similar error.

Cannot read property 'blue' of undefined

Stack:

TypeError: 
    at http://localhost:3333/static/js/app.bundle.js:121657:28
    at Array.reduce (<anonymous>)
    at Object.<anonymous> (http://localhost:3333/static/js/app.bundle.js:121655:33)
    at __webpack_require__ (http://localhost:3333/static/js/vendor.bundle.js:713:30)
    at fn (http://localhost:3333/static/js/vendor.bundle.js:118:20)
    at Object.<anonymous> (http://localhost:3333/static/js/app.bundle.js:121616:16)
    at __webpack_require__ (http://localhost:3333/static/js/vendor.bundle.js:713:30)
    at fn (http://localhost:3333/static/js/vendor.bundle.js:118:20)
    at Object.<anonymous> (http://localhost:3333/static/js/app.bundle.js:121592:18)
    at __webpack_require__ (http://localhost:3333/static/js/vendor.bundle.js:713:30)

(Your browsers Developer Tools may contain more info)

image

this is what I see at the breakpoint. looks like hues is undefined at this point

Read more comments on GitHub >

github_iconTop Results From Across the Web

Studio won't start (Uncaught TypeError: Cannot read ...
I'm getting the following when trying to run the latest version of Sanity: Uncaught error Cannot read property 'sanity' of undefined Stack: ...
Read more >
I get this error when trying to...
I get this error when trying to run a Sanity Studio Uncaught TypeError: Cannot read property 'sanity' of undefined.
Read more >
next.js - sanity error: Cannot read properties of undefined ...
The setup is successfully completed. Npm run dev spins out the app on localhost successfully. But the problem is when I start the...
Read more >
next-sanity
The latest version of Sanity Studio allows you to embed a near-infinitely configurable content editing interface into any React application.
Read more >
How to run a Sanity backed blog with React and Next.js
When the installation is done, you can run sanity start to launch the Content Studio where you can start editing your content.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found