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

gatsby build fails with "Element type is invalid" and yoga-layout-prebuilt errors #36547

Closed
2 tasks done
SachaG opened this issue Sep 6, 2022 · 4 comments
Closed
2 tasks done
Labels
status: needs reproduction This issue needs a simplified reproduction of the bug for further troubleshooting. type: bug An issue or pull request relating to a bug in Gatsby

Comments

@SachaG
Copy link
Contributor

SachaG commented Sep 6, 2022

Preliminary Checks

Description

Build fails with the following error:


failed Building static HTML for pages - 27.315s

 ERROR #95313

Building static HTML failed for path "/en-US/"

See our docs page for more info on this error: https://gatsby.dev/debug-html


  35 | //
  36 | //     { route, params, uri }
> 37 | //
     | ^
  38 | // I know, I should use TypeScript not comments for these types.
  39 | var pick = function pick(routes, uri) {
  40 |   var match = void 0;


  WebpackError: Minified React error #130; visit https://reactjs.org/docs/error-decoder.html?invariant=130&args[]=undefined&args[]= for the full message or u
  se the non-minified dev environment for full errors and additional helpful warnings.

  - utils.js:37
    [monorepo-results]/[@gatsbyjs]/reach-router/lib/utils.js:37:1

  - index.js:33
    [monorepo-results]/[exenv]/index.js:33:4

  - utils.js:44
    [monorepo-results]/[@gatsbyjs]/reach-router/lib/utils.js:44:1

  - static-entry.js:303
    monorepo-results/.cache/static-entry.js:303:22

  - index.module.js:18
    [monorepo-results]/[@radix-ui]/react-collection/dist/index.module.js:18:1

I have tried commenting out parts of my codebase, and by doing this I get another error:

/Users/sacha/Dev/stateof-monorepo/results/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
        throw ex;
        ^

Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined.
    at Xc (/Users/sacha/Dev/stateof-monorepo/results/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:77:77)
    at Z (/Users/sacha/Dev/stateof-monorepo/results/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:78:89)
    at Vc (/Users/sacha/Dev/stateof-monorepo/results/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:70:473)
    at Xc (/Users/sacha/Dev/stateof-monorepo/results/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:72:210)
    at Z (/Users/sacha/Dev/stateof-monorepo/results/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:78:89)
    at Xc (/Users/sacha/Dev/stateof-monorepo/results/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:76:231)
    at Z (/Users/sacha/Dev/stateof-monorepo/results/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:78:89)
    at Yc (/Users/sacha/Dev/stateof-monorepo/results/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:81:98)
    at Xc (/Users/sacha/Dev/stateof-monorepo/results/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:73:145)
    at Z (/Users/sacha/Dev/stateof-monorepo/results/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:78:89)
    at Vc (/Users/sacha/Dev/stateof-monorepo/results/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:70:473)
    at Xc (/Users/sacha/Dev/stateof-monorepo/results/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:72:210)
    at Z (/Users/sacha/Dev/stateof-monorepo/results/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:78:89)
    at Xc (/Users/sacha/Dev/stateof-monorepo/results/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:76:489)
    at Z (/Users/sacha/Dev/stateof-monorepo/results/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:78:89)
failed Building static HTML for pages - 12.302s

 ERROR #95313

Building static HTML failed

See our docs page for more info on this error: https://gatsby.dev/debug-html


  37 | //     units: PropTypes.oneOf(['percentage', 'count', 'percentage_survey']).isRequired,
  38 | //     onChange: PropTypes.func.isRequired
> 39 | // }
     | ^
  40 |
  41 | export default memo(BlockUnitsSelector)
  42 |


  WebpackError: Worker exited before finishing task

  - BlockUnitsSelector.js:39
    monorepo-results/src/core/blocks/block/BlockUnitsSelector.js:39:1

  - index.module.js:1
    [monorepo-results]/[@radix-ui]/react-tabs/dist/index.module.js:1:87

  - index.module.js:6
    [monorepo-results]/[@radix-ui]/react-roving-focus/dist/index.module.js:6:89

It seems like the part of the code being pointed to might not be relevant to the actual issue, as it sometimes points to commented-out code.

Reproduction Link

https://github.com/Devographics/Monorepo/tree/main/results

Steps to Reproduce

I have not able to reproduce the issue in the context of a fresh project, but I run into it consistently on my project every time I try to build, both locally and on Netlify.

Expected Result

It builds.

Actual Result

It fails.

Environment

System:
    OS: macOS 11.6
    CPU: (8) x64 Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.15.0 - ~/.nvm/versions/node/v16.15.0/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 8.17.0 - ~/.nvm/versions/node/v16.15.0/bin/npm
  Languages:
    Python: 2.7.16 - /usr/bin/python
  Browsers:
    Chrome: 104.0.5112.101
    Firefox: 103.0.2
    Safari: 15.0
  npmPackages:
    gatsby: ^4.19.1 => 4.22.0
    gatsby-cli: ^4.1.0 => 4.22.0
    gatsby-plugin-google-analytics: ^4.1.0 => 4.22.0
    gatsby-plugin-mdx: ^3.1.0 => 3.20.0
    gatsby-plugin-netlify: ^4.0.0-next.0 => 4.4.0
    gatsby-plugin-perf-budgets: ^0.0.18 => 0.0.18
    gatsby-plugin-react-helmet: ^5.1.0 => 5.22.0
    gatsby-plugin-sass: ^5.1.0 => 5.22.0
    gatsby-plugin-styled-components: ^5.1.0 => 5.22.0
    gatsby-plugin-webpack-bundle-analyser-v2: ^1.1.26 => 1.1.27
    gatsby-source-filesystem: ^4.1.0 => 4.22.0
    gatsby-source-graphql: ^4.19.0 => 4.22.0
    gatsby-transformer-remark: ^5.1.0 => 5.22.0
    gatsby-transformer-yaml: ^4.1.0 => 4.22.0
  npmGlobalPackages:
    gatsby-cli: 4.22.0

Config Flags

No response

@SachaG SachaG added the type: bug An issue or pull request relating to a bug in Gatsby label Sep 6, 2022
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Sep 6, 2022
@LekoArts LekoArts added status: needs reproduction This issue needs a simplified reproduction of the bug for further troubleshooting. and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Sep 6, 2022
@LekoArts
Copy link
Contributor

LekoArts commented Sep 6, 2022

You're running a monorepo so my best guess is that your different packages have clashing (internal) versions that are incompatible. Especially since you said:

I have not able to reproduce the issue in the context of a fresh project

Try these things:

  • Remove gatsby-cli from the deps since it's not needed
  • Check if you have multiple versions of packages installed (like react etc.)
  • Update react to v18 (since you pinned it to v17) since MDX v2 wants React 18
  • Remove packages bit by bit (e.g. radix) and see when it works
  • Downgrade Radix (since it's a major version bump)

I'm pretty sure it's an issue in your repo and not a Gatsby issue in general.

@Khaledgarbaya
Copy link
Contributor

it's a quite big jump when updating Radix from 0.1 to 1.0.0. I pushed a PR to make the building work again. This was not related to Gatsby it's more a dependency upgrade issue

@SachaG
Copy link
Contributor Author

SachaG commented Sep 6, 2022

Thanks for the amazing support, and yeah sorry for posting here even though it wasn't related to Gatsby. Googling led to other threads mentioning that yoga-layout thing so I started thinking it was a common issue…

My only wish would be that Gatsby's error reporting could somehow have pointed me in the right direction, but I don't know if there's any way to achieve that. I got so bogged down commenting my own app code on and off thinking the problem was coming from my own components that I completely forgot about dependencies!

@Khaledgarbaya
Copy link
Contributor

No worries, the error message was not leading to anything which is something we should work on.
tip: to debug build time errors you can enable DEV_SSR to receive a better error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs reproduction This issue needs a simplified reproduction of the bug for further troubleshooting. type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

No branches or pull requests

3 participants