Module not found: Error: Can't resolve 'part:@sanity/desk-tool/structure

9 replies
Last updated: Apr 14, 2022
Hi, all!
Added

{

"name": "part:@sanity/desk-tool/structure",

"path": "./schemas/deskStructure.js"

}
to sanity.json, and now I get "Error in ./node_modules/@sanity/desk-tool/lib/utils/loadStructure.js
Module not found: Error: Can't resolve 'part:@sanity/desk-tool/structure?'"

Any idea, anyone?
Mar 24, 2022, 11:28 AM
Yup, it's in there with the schemas. I have tried moving it around, but the error stays the same.
Mar 24, 2022, 8:49 PM
What does your deskStructure look like?
Mar 24, 2022, 9:31 PM
import S from '@sanity/desk-tool/structure-builder'

export default () =>
  S.list()
    .title('Contentss')
    .items([
      // List out all the document types in schema.js
      ...S.documentTypeListItems(),
      // Add a new list item for projects by category
      S.listItem()
        .title('Projects by category')
        .child(
          // List out all categories
          S.documentTypeList('department')
            .title('Projects by category')
            .child(catId =>
              // List out project documents where the _id for the selected
              // category appear as a _ref in the project's categories array
              S.documentList()
                .schemaType('person')
                .title('Projects')
                .filter(
                  '_type == "person" && $catId in departments[]._ref'
                )
                .params({ catId })
            )
        ),
    ])
It's a slightly modified version of one of your examples. But I don't think it's the problem. I can strip it, simplify it, throw something else in there and the error stays the same.
Mar 25, 2022, 6:20 AM
Sone additional details....
Mar 25, 2022, 7:08 AM
Hm, very strange! Can you try deleting and reinstalling node modules?
Mar 25, 2022, 4:09 PM
Yup, but didn't help.
Mar 26, 2022, 7:32 AM
Hm, started from scratch and now it works. Strange. Anyway, thanks for your help,
user M
.
Mar 27, 2022, 11:58 AM
I'm getting the same error here 😞Nevermind found the problem here
Apr 14, 2022, 2:58 PM
I was using the wrong path inside the sanity.json file πŸ˜…
Apr 14, 2022, 5:25 PM

Sanity– build remarkable experiences at scale

The Sanity Composable Content Cloud is the 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?

Categorized in