Error with reading property 'sanity' resolved by deleting node_modules and reinstalling packages
30 replies
Last updated: Feb 4, 2021
S
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
S
wild guess: have you set
project.basepathin your sanity.json?
Feb 4, 2021, 7:14 PM
S
Currently:
Feb 4, 2021, 7:15 PM
S
"basePath": "/"
Feb 4, 2021, 7:15 PM
S
The setup is Gatsby in a web folder and the studio in a separate studio folder.
Feb 4, 2021, 7:16 PM
S
have you tried removing node_modules and package-lock and reinstall?
Feb 4, 2021, 7:17 PM
S
I am currently going through this process
Feb 4, 2021, 7:17 PM
S
I tried it another time already to no avail, but wanted to give it a shot again.
Feb 4, 2021, 7:17 PM
S
Give me a second. I will report back in a minute.
Feb 4, 2021, 7:18 PM
S
By the way, thank you a lot for jumping in that fast. You are awesome π
Feb 4, 2021, 7:20 PM
S
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
S
I didn't fire up gatsby so far, which should be no problem?
Feb 4, 2021, 7:24 PM
S
Additional info from the devtools:
Feb 4, 2021, 7:24 PM
S
The deploy doesn't complain and seems to be successful:
Feb 4, 2021, 7:25 PM
S
and are all your packages up to date?
Feb 4, 2021, 7:26 PM
S
sanity upgrade
Feb 4, 2021, 7:26 PM
S
I will run it π
Feb 4, 2021, 7:26 PM
S
Yes, they are.
Feb 4, 2021, 7:26 PM
S
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
S
I went through that thread as well.
Feb 4, 2021, 7:28 PM
S
This is the only hit I got for this issue.
Feb 4, 2021, 7:28 PM
S
local build succeeds?
Feb 4, 2021, 7:28 PM
S
Yes
Feb 4, 2021, 7:28 PM
S
No warnings or anything.
Feb 4, 2021, 7:29 PM
S
I also deployed the studio to test, same issue.
Feb 4, 2021, 7:29 PM
S
Successful deploy, same error.
Feb 4, 2021, 7:29 PM
S
I've got to go, sorry! Maybe someone can else jump in π
Feb 4, 2021, 7:30 PM
S
testCookie gives me a 404, that could be related?
Feb 4, 2021, 7:30 PM
S
Sure. Thank you for the input, Arjen!
Feb 4, 2021, 7:30 PM
S
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
S
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.