Issue with structure-builder module in Sanity.io project

14 replies
Last updated: Jun 11, 2022
[NOT SOLVED]Hello everyone, hope you are all doing great. I have an issue with structure-builder and hope someone could give me a help with it. I was following
https://www.sanity.io/guides/getting-started-with-structure-builder , but I can't seem to make it work. Issue I am facing is :
Module not found: Error: Can't resolve 'part:@sanity/desk-tool/structure?'

I tried researching more about this module, but any help I found online didn't work for me. Could someone please aid me with this ?
Jun 11, 2022, 11:54 AM
Did you define the part in your Sanity.json and a file at that path exists?
Jun 11, 2022, 1:47 PM
{
  "root": true,
  "project": {
    "name": "digitale-grundung"
  },
  "api": {
    "projectId": "xxxxxxxx",
    "dataset": "production"
  },
  "plugins": [
    "@sanity/base",
    "@sanity/components",
    "@sanity/default-layout",
    "@sanity/default-login",
    "@sanity/dashboard",
    "@sanity/desk-tool"
  ],
  "env": {
    "development": {
      "plugins": [
        "@sanity/vision"
      ]
    }
  },
  "parts": [
    {
      "name": "part:@sanity/desk-tool/structure",
      "path": "./deskStructure.js"
    },
    {
      "name": "part:@sanity/base/schema",
      "path": "./schemas/schema"
    }
  ]
}
Jun 11, 2022, 2:02 PM
this would be my structure of sanity.json
Jun 11, 2022, 2:02 PM
And
deskStructure.js
exists?
Jun 11, 2022, 2:03 PM
Yes, this is how it looks :
Jun 11, 2022, 2:03 PM
import S from '@sanity/desk-tool/structure-builder'

export default () =>
  S.list()
    .title('Contents')
    .items(
      S.documentTypeListItems()
    )
Jun 11, 2022, 2:03 PM
pretty basic stuff to make it start working, would customize it further after
Jun 11, 2022, 2:03 PM
It looks good. Even with a restart, it doesn‘t work?
Jun 11, 2022, 2:09 PM
Sadly, not. Tried removing
node_modules
as well, didn't help. Always getting
Module not found: Error: Can't resolve 'part:@sanity/desk-tool/structure?'
Jun 11, 2022, 2:12 PM
Would you mind sharing your structure in
node_modules/@sanity/desk-tools/
Jun 11, 2022, 2:13 PM
If you search for this in your codebase, do you have more hits than just the
sanity.json
one?
Jun 11, 2022, 2:13 PM
This issue is being triggered inside of
/node_modules/@sanity/structure/lib/parts/userStructure.js
. Full issue is :

Module not found: Error: Can't resolve 'part:@sanity/desk-tool/structure?' in '/home/aljosa/Documents/projects/xxxxxx/frontend/sanity/node_modules/@sanity/structure/lib/parts'
Jun 11, 2022, 2:15 PM
Which version of Sanity are you using?
Jun 11, 2022, 2:27 PM
@sanity/cli version 2.30.0
Jun 11, 2022, 2:28 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?