Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

Error with reading property 'sanity' resolved by deleting node_modules and reinstalling packages

30 replies
Last updated: Feb 4, 2021
Uncaught error
Cannot read property 'sanity' of undefined

Stack:

TypeError: 
    at <https://dolcestilcriollo.sanity.studio/static/js/app.bundle.js?f8e5bbd157acfb86fc43:1163:3413841>
    at ye (<https://dolcestilcriollo.sanity.studio/static/js/app.bundle.js?f8e5bbd157acfb86fc43:30:552292>)
    at ye (<https://dolcestilcriollo.sanity.studio/static/js/app.bundle.js?f8e5bbd157acfb86fc43:30:552065>)
    at e.t.createStyles (<https://dolcestilcriollo.sanity.studio/static/js/app.bundle.js?f8e5bbd157acfb86fc43:30:558162>)
    at e.t.renderStyles (<https://dolcestilcriollo.sanity.studio/static/js/app.bundle.js?f8e5bbd157acfb86fc43:30:558401>)
    at u (<https://dolcestilcriollo.sanity.studio/static/js/app.bundle.js?f8e5bbd157acfb86fc43:30:558961>)
    at <https://dolcestilcriollo.sanity.studio/static/js/app.bundle.js?f8e5bbd157acfb86fc43:30:558777>
    at ro (<https://dolcestilcriollo.sanity.studio/static/js/vendor.bundle.js?2163562f6812e454f877:17:83208>)
    at lo (<https://dolcestilcriollo.sanity.studio/static/js/vendor.bundle.js?2163562f6812e454f877:17:83311>)
    at pu (<https://dolcestilcriollo.sanity.studio/static/js/vendor.bundle.js?2163562f6812e454f877:17:101245>)

(Your browsers Developer Tools may contain more info)
Feb 4, 2021, 7:12 PM
wild guess: have you set
project.basepath
in your sanity.json?
Feb 4, 2021, 7:14 PM
Currently:
Feb 4, 2021, 7:15 PM
"basePath": "/"
Feb 4, 2021, 7:15 PM
The setup is Gatsby in a web folder and the studio in a separate studio folder.
Feb 4, 2021, 7:16 PM
have you tried removing node_modules and package-lock and reinstall?
Feb 4, 2021, 7:17 PM
I am currently going through this process
Feb 4, 2021, 7:17 PM
I tried it another time already to no avail, but wanted to give it a shot again.
Feb 4, 2021, 7:17 PM
Give me a second. I will report back in a minute.
Feb 4, 2021, 7:18 PM
By the way, thank you a lot for jumping in that fast. You are awesome πŸŽ‰
Feb 4, 2021, 7:20 PM
So far still the same result, but I also can't find the node_module folder by any means. Is this referring to a node_module folder that should be generated by the studio or gatsby?
Feb 4, 2021, 7:23 PM
I didn't fire up gatsby so far, which should be no problem?
Feb 4, 2021, 7:24 PM
Additional info from the devtools:
Feb 4, 2021, 7:24 PM
The deploy doesn't complain and seems to be successful:
Feb 4, 2021, 7:25 PM
and are all your packages up to date?
Feb 4, 2021, 7:26 PM
sanity upgrade
Feb 4, 2021, 7:26 PM
I will run it πŸ‘
Feb 4, 2021, 7:26 PM
Yes, they are.
Feb 4, 2021, 7:26 PM
everyone here suggests deleting node modules, but if that doesn't work… πŸ˜• https://github.com/sanity-io/sanity/issues/2190
Feb 4, 2021, 7:28 PM
I went through that thread as well.
Feb 4, 2021, 7:28 PM
This is the only hit I got for this issue.
Feb 4, 2021, 7:28 PM
local build succeeds?
Feb 4, 2021, 7:28 PM
Yes
Feb 4, 2021, 7:28 PM
No warnings or anything.
Feb 4, 2021, 7:29 PM
I also deployed the studio to test, same issue.
Feb 4, 2021, 7:29 PM
Successful deploy, same error.
Feb 4, 2021, 7:29 PM
I've got to go, sorry! Maybe someone can else jump in πŸ™‚
Feb 4, 2021, 7:30 PM
testCookie gives me a 404, that could be related?
Feb 4, 2021, 7:30 PM
Sure. Thank you for the input, Arjen!
Feb 4, 2021, 7:30 PM
Okay, resolved it. I thought, that the node_module folder wasn't initialized or that it simply would be somewhere else (who knows why), but I explicitly ignored it in vscodium. Node_module folder and package-lock.json deleted, reinstalled packages and it works like a charm (in Firefox at least, while Chromium just didn't want to accept the login cookie). Thank you for the input Arjen and I hope you excuse my silly oversight.
Feb 4, 2021, 7:48 PM
Great! Glad to hear you got it working πŸ‘
Feb 4, 2021, 8:25 PM

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?