Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The structure tool crashed #6739

Closed
jacobhq opened this issue May 22, 2024 · 9 comments
Closed

The structure tool crashed #6739

jacobhq opened this issue May 22, 2024 · 9 comments
Labels

Comments

@jacobhq
Copy link

jacobhq commented May 22, 2024

When I try to modify any content in sanity studio, I get this error:

image

The structure tool crashed

Error: Module [project]/node_modules/.pnpm/sanity@3.43.0_@types+node@20.12.12_@types+react@18.3.2_react-dom@18.3.1_react@18.3.1_styled-components@6.1.11/node_modules/sanity/lib/_chunks-es/pane.mjs [app-client] (ecmascript, async loader) was instantiated because it was required from module [project]/node_modules/.pnpm/sanity@3.43.0_@types+node@20.12.12_@types+react@18.3.2_react-dom@18.3.1_react@18.3.1_styled-components@6.1.11/node_modules/sanity/lib/_chunks-es/index3.mjs [app-client] (ecmascript), but the module factory is not available. It might have been deleted in an HMR update.
Error: Module [project]/node_modules/.pnpm/sanity@3.43.0_@types+node@20.12.12_@types+react@18.3.2_react-dom@18.3.1_react@18.3.1_styled-components@6.1.11/node_modules/sanity/lib/_chunks-es/pane.mjs [app-client] (ecmascript, async loader) was instantiated because it was required from module [project]/node_modules/.pnpm/sanity@3.43.0_@types+node@20.12.12_@types+react@18.3.2_react-dom@18.3.1_react@18.3.1_styled-components@6.1.11/node_modules/sanity/lib/_chunks-es/index3.mjs [app-client] (ecmascript), but the module factory is not available. It might have been deleted in an HMR update.
    at instantiateModule (http://localhost:3000/_next/static/chunks/aa26a_next_dist_esm_build_templates_app-page_531bae.js:494:15)
    at getOrInstantiateModuleFromParent (http://localhost:3000/_next/static/chunks/aa26a_next_dist_esm_build_templates_app-page_531bae.js:609:12)
    at commonJsRequire (http://localhost:3000/_next/static/chunks/aa26a_next_dist_esm_build_templates_app-page_531bae.js:146:20)
    at http://localhost:3000/_next/static/chunks/node_modules__pnpm_791d38._.js:890:329
    at lazyInitializer (http://localhost:3000/_next/static/chunks/aa26a_next_dist_compiled_react_4f95b0._.js:1767:32)
    at mountLazyComponent (http://localhost:3000/_next/static/chunks/aa26a_next_dist_compiled_react-dom_cjs_react-dom_development_27328b.js:14571:29)
    at beginWork$1 (http://localhost:3000/_next/static/chunks/aa26a_next_dist_compiled_react-dom_cjs_react-dom_development_27328b.js:15959:32)
    at beginWork (http://localhost:3000/_next/static/chunks/aa26a_next_dist_compiled_react-dom_cjs_react-dom_development_27328b.js:22853:28)
    at performUnitOfWork (http://localhost:3000/_next/static/chunks/aa26a_next_dist_compiled_react-dom_cjs_react-dom_development_27328b.js:21895:24)
    at workLoopSync (http://localhost:3000/_next/static/chunks/aa26a_next_dist_compiled_react-dom_cjs_react-dom_development_27328b.js:21660:17)
    at renderRootSync (http://localhost:3000/_next/static/chunks/aa26a_next_dist_compiled_react-dom_cjs_react-dom_development_27328b.js:21627:21)
    at recoverFromConcurrentError (http://localhost:3000/_next/static/chunks/aa26a_next_dist_compiled_react-dom_cjs_react-dom_development_27328b.js:20929:30)
    at performSyncWorkOnRoot (http://localhost:3000/_next/static/chunks/aa26a_next_dist_compiled_react-dom_cjs_react-dom_development_27328b.js:21176:34)
    at flushSyncWorkAcrossRoots_impl (http://localhost:3000/_next/static/chunks/aa26a_next_dist_compiled_react-dom_cjs_react-dom_development_27328b.js:7079:33)
    at flushSyncWorkOnAllRoots (http://localhost:3000/_next/static/chunks/aa26a_next_dist_compiled_react-dom_cjs_react-dom_development_27328b.js:7045:13)
    at commitRootImpl (http://localhost:3000/_next/static/chunks/aa26a_next_dist_compiled_react-dom_cjs_react-dom_development_27328b.js:22394:13)
    at commitRoot (http://localhost:3000/_next/static/chunks/aa26a_next_dist_compiled_react-dom_cjs_react-dom_development_27328b.js:22165:17)
    at commitRootWhenReady (http://localhost:3000/_next/static/chunks/aa26a_next_dist_compiled_react-dom_cjs_react-dom_development_27328b.js:21056:13)
    at finishConcurrentRender (http://localhost:3000/_next/static/chunks/aa26a_next_dist_compiled_react-dom_cjs_react-dom_development_27328b.js:21027:17)
    at performConcurrentWorkOnRoot (http://localhost:3000/_next/static/chunks/aa26a_next_dist_compiled_react-dom_cjs_react-dom_development_27328b.js:20897:25)
    at workLoop (http://localhost:3000/_next/static/chunks/aa26a_next_dist_compiled_3acffd._.js:1151:48)
    at flushWork (http://localhost:3000/_next/static/chunks/aa26a_next_dist_compiled_3acffd._.js:1129:28)
    at MessagePort.performWorkUntilDeadline (http://localhost:3000/_next/static/chunks/aa26a_next_dist_compiled_3acffd._.js:1367:35)

I have updated all my dependencies, and had a look on google, chatgpt etc. but I can't find anything. I am attactching some files in code blocks below. Happy to share more if needed. I'm using the sanity setup created by sanity cli. Thanks in advance!

import {defineType, defineField} from "sanity";

export const category = defineType({
  name: 'category',
  type: 'document',
  title: 'Categories',
  fields: [
    defineField({
      name: 'name',
      title: 'Name of Category',
      type: 'string',
    }),
  ],
})

export const product = defineType({
  name: 'product',
  type: 'document',
  title: 'Product',
  fields: [
    defineField({
      name: 'name',
      type: 'string',
      title: 'Name of Product',
    }),
    defineField({
      name: 'images',
      type: 'array',
      title: 'Product Images',
      of: [{type: 'image'}],
    }),
    defineField({
      name: 'description',
      type: 'text',
      title: 'Description of product',
    }),
    defineField({
      name: 'slug',
      type: 'slug',
      title: 'Product Slug',
      options: {
        source: 'name',
      },
    }),
    defineField({
      name: 'price',
      title: 'Price',
      type: 'number',
    }),
    defineField({
      name: 'price_id',
      title: 'Stripe Price ID',
      type: 'string',
    }),
    defineField({
      name: 'category',
      title: 'Product Category',
      type: 'reference',
      to: [
        {
          type: 'category',
        },
      ],
    }),
  ],
})

export const heroImage = defineType({
  name: 'heroImage',
  type: 'document',
  title: 'Two Hero Images',
  fields: [
    defineField({
      name: 'image1',
      type: 'image',
      title: 'First Image',
    }),
    defineField({
      name: 'image2',
      type: 'image',
      title: 'Second Image',
    }),
  ],
})
{
  "name": "lmn-front",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev --turbo",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@radix-ui/react-dialog": "^1.0.5",
    "@radix-ui/react-slot": "^1.0.2",
    "@sanity/image-url": "^1.0.2",
    "@sanity/vision": "^3.43.0",
    "@stripe/stripe-js": "^3.4.1",
    "class-variance-authority": "^0.7.0",
    "clsx": "^2.1.1",
    "lucide-react": "^0.379.0",
    "next": "^14.2.3",
    "next-sanity": "^9.1.1",
    "react": "^18.3.1",
    "react-dom": "^18.3.1",
    "sanity": "^3.43.0",
    "stripe": "^15.7.0",
    "styled-components": "^6.1.11",
    "tailwind-merge": "^2.3.0",
    "tailwindcss-animate": "^1.0.7",
    "use-shopping-cart": "^3.2.0"
  },
  "devDependencies": {
    "@types/node": "^20.12.12",
    "@types/react": "^18.3.2",
    "@types/react-dom": "^18.3.0",
    "autoprefixer": "^10.4.19",
    "eslint": "^8.57.0",
    "eslint-config-next": "^14.2.3",
    "postcss": "^8.4.38",
    "tailwindcss": "^3.4.3",
    "typescript": "^5.4.5"
  }
}
@rexxars
Copy link
Member

rexxars commented May 23, 2024

Are you using turbo/the turbo flag for your next application? This sounds like an issue that we've seen before with turbo and/or pnpm workspaces

@dev-lawrence
Copy link

I'm sure he's using turbo flag. because I am getting similar errors too. Is there any solution for it?

@jacobhq
Copy link
Author

jacobhq commented May 26, 2024

Are you using turbo/the turbo flag for your next application? This sounds like an issue that we've seen before with turbo and/or pnpm workspaces

Yep, turbo and pnpm, but not workspaces, just regular pnpm.

@bjoerge
Copy link
Member

bjoerge commented May 27, 2024

Does it work if turning off the turbo flag? This looks like it could be related: vercel/next.js#61180

@bramdoppen
Copy link

bramdoppen commented May 28, 2024

I experienced the same issues with the turbo flag on, in combination with Yarn.

@linear linear bot added the bug label Jun 5, 2024
@juice49
Copy link
Contributor

juice49 commented Jun 11, 2024

This appears to be related to Turbopack, and should be resolved with the upcoming Next.js 15 release. If it's convenient for you, please give the release candidate a go and let us know whether you still encounter this issue. You can test Next.js 15 by installing the following dependencies: next@rc react@rc react-dom@rc.

@bramdoppen
Copy link

Thanks @juice49 , works for me! The problems I experienced are gone now. HMR is blazing fast!

@juice49
Copy link
Contributor

juice49 commented Jun 13, 2024

@bramdoppen fantastic! Thank you for letting us know.

@juice49 juice49 closed this as completed Jun 13, 2024
Copy link
Contributor

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants