Discussion about resolving an error in setting up a custom desk structure in Sanity.io
42 replies
Last updated: Mar 26, 2021
M
Hey everyone! I was just trying to setup a custom desk strcuture following this article here: https://www.sanity.io/guides/getting-started-with-structure-builder But I always get this error:
Any ideas? Thanks!
Any ideas? Thanks!
Mar 26, 2021, 10:03 AM
N
This is my `deskStructure.js`:
import S from "@sanity/desk-tool/structure-builder";
export default () =>
S.list()
.title("Content")
.items([
S.listItem()
.title("Settings")
.child(
S.document().schemaType("siteSettings").documentId("siteSettings")
),
...S.documentTypeListItems(),
]);Mar 26, 2021, 10:04 AM
M
Which version are you on,
user N
?Mar 26, 2021, 10:09 AM
M
hey
Mar 26, 2021, 10:10 AM
M
uhm
Mar 26, 2021, 10:10 AM
N
"dependencies": {
"@sanity/base": "^2.7.1",
"@sanity/components": "^2.2.6",
"@sanity/core": "^2.7.1",
"@sanity/dashboard": "^2.7.0",
"@sanity/default-layout": "^2.7.1",
"@sanity/default-login": "^2.7.0",
"@sanity/desk-tool": "^2.7.1",
"@sanity/structure": "^2.7.1",
"@sanity/vision": "^2.7.0",
"prop-types": "^15.7",
"react": "^17.0",
"react-dom": "^17.0"
},Mar 26, 2021, 10:10 AM
N
this?
Mar 26, 2021, 10:10 AM
R
Is that not a weird require to have a ? At the end?
Mar 26, 2021, 10:17 AM
N
It's like that on next branch.
Mar 26, 2021, 10:17 AM
N
Hey man. what do you mean?
Mar 26, 2021, 10:18 AM
N
How does your
sanity.jsonlook like?
Mar 26, 2021, 10:19 AM
M
{
"root": true,
"project": {
"name": "Minoo Website"
},
"api": {
"projectId": "ab10er4l",
"dataset": "production"
},
"plugins": [
"@sanity/base",
"@sanity/components",
"@sanity/default-layout",
"@sanity/default-login",
"@sanity/desk-tool"
],
"parts": [
{
"name": "part:@sanity/base/schema",
"path": "./schemas/schema.js"
},
{
"name": "part:@sanity/desk-tool/structure",
"path": "./deskStructure.js"
}
]
}Mar 26, 2021, 10:20 AM
M
Did you recently add the
@sanity/structurepackage and forgot to
npm i?
Mar 26, 2021, 10:25 AM
N
npm? I have a yarn.lock..
Mar 26, 2021, 10:25 AM
N
OK. Did you recently add
@sanity/structuremanually in your
package.jsonand not run
yarn?
Mar 26, 2021, 10:26 AM
N
also where would I add
@sanity/structure?
Mar 26, 2021, 10:26 AM
M
ah .. no i dont think so
Mar 26, 2021, 10:26 AM
N
hm maybe? I was trying to get rid of this error and might have done something like
sanity install @sanity/structure
Mar 26, 2021, 10:27 AM
N
try removing your
node_modulesand run
sanity installagain.
Mar 26, 2021, 10:28 AM
M
😕
Mar 26, 2021, 10:30 AM
N
Your
deskStructure.jsfile is on your root?
Mar 26, 2021, 10:34 AM
N
Sanity is in
/studioand this is the directory strcuture in there:
Mar 26, 2021, 10:35 AM
M
OK. That should be fine.Could you try removing
@sanity/structureas a direct dependency, remove
node_modulesand to
sanity installagain?
Mar 26, 2021, 10:36 AM
M
hold on 🙂
Mar 26, 2021, 10:37 AM
N
Meeehhh..
Mar 26, 2021, 10:39 AM
N
so sorry man thanks for taking the time
Mar 26, 2021, 10:39 AM
N
No worries, I'm here to help. 🙂
Mar 26, 2021, 10:40 AM
N
my
package.jsonlooks like this now:
{
"name": "minoowebsite",
"private": true,
"version": "1.0.0",
"description": "",
"main": "package.json",
"author": "Nils Borgböhmer <nils@dinghy.studio>",
"license": "UNLICENSED",
"scripts": {
"start": "sanity start",
"build": "sanity build"
},
"keywords": [
"sanity"
],
"dependencies": {
"@sanity/base": "^2.7.1",
"@sanity/components": "^2.2.6",
"@sanity/core": "^2.7.1",
"@sanity/dashboard": "^2.7.0",
"@sanity/default-layout": "^2.7.1",
"@sanity/default-login": "^2.7.0",
"@sanity/desk-tool": "^2.7.1",
"@sanity/vision": "^2.7.0",
"prop-types": "^15.7",
"react": "^17.0",
"react-dom": "^17.0"
},
"devDependencies": {}
}Mar 26, 2021, 10:40 AM
N
Not sure what is going on here. This should work. 🤔
Mar 26, 2021, 10:57 AM
N
I agree!
Mar 26, 2021, 10:57 AM
N
😄
Mar 26, 2021, 10:57 AM
N
this is also not my first sanity setup..
Mar 26, 2021, 10:57 AM
N
Woops. You have a type in your
deskStructure.jsfile.
Mar 26, 2021, 10:58 AM
N
WHAT!
Mar 26, 2021, 10:58 AM
N
Typo*
Mar 26, 2021, 10:58 AM
N
Where?
Mar 26, 2021, 10:58 AM
N
Your
deskStructure.jsfile. It's called
deskStucture.js.
Mar 26, 2021, 10:58 AM
N
NOOOOOOO
Mar 26, 2021, 10:59 AM
N
hehe … man
Mar 26, 2021, 11:02 AM
N
thanks a lot!
Mar 26, 2021, 11:02 AM
N
case closed
Mar 26, 2021, 11:02 AM
N
😄 Happy to help.
Mar 26, 2021, 11:03 AM
N
user P
I got the same error today but because I was renaming by deskStructure file from .js to .ts while sanity.json was still "linking" to the .js file. Maybe it would be worth returning a better error message when the deskStructure file is not found :)Mar 26, 2021, 11:30 AM
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.