hasura / gatsby-gitbook-starter

Generate GitBook style modern docs/tutorial websites using Gatsby + MDX
https://hasura.io/learn/graphql/react/introduction/
MIT License
984 stars 378 forks source link

Build failing when parsing MDX #18

Closed lovettbarron closed 4 years ago

lovettbarron commented 4 years ago

Getting errors when attempting to build the application. Specifically:

 ERROR #95313

Building static HTML failed for path "/modules/pl7505/1-discussion"

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

   9 | /* eslint-disable react/display-name */
  10 | export default {
> 11 |   h1: props => <Heading id={props.children.replace(/\s+/g, '').toLowerCase()} {...props} is="h1" fontSize={[5, 6]} />,
     |                                            ^
  12 |   h2: props => <Heading id={props.children.replace(/\s+/g, '').toLowerCase()} {...props} is="h2" fontSize={[4]} />,
  13 |   h3: props => <Heading id={props.children.replace(/\s+/g, '').toLowerCase()} {...props} is="h3" fontSize={3} />,
  14 |   h4: props => <Heading id={props.children.replace(/\s+/g, '').toLowerCase()} {...props} is="h4" fontSize={2} />,

  WebpackError: TypeError: Cannot read property 'replace' of undefined
  - index.js:11 h1
    src/components/mdxComponents/index.js:11:44

⠸ Building static HTML for pages

The repo I'm trying to build is at: https://github.com/readywater/sec.andrewlb.com

And I'm trying to deploy it to gh-pages as well, though this is pre-deployment, as the failure is happening on the build phase.

techtolentino commented 4 years ago

@readywater

The reason this isn't building properly is because there's an empty markdown h1, and I assume the build process is looking for some string at this point?

Look in your code here: https://github.com/readywater/sec.andrewlb.com/blame/master/content/modules/pl7505/1-discussion.md#L7

praveenweb commented 4 years ago

@readywater - This usually happens when the heading tags (h1, h2 .., h6) are empty or if they have special characters like `, quoting the string in between.

praveenweb commented 4 years ago

I'm closing this for now. Feel free to reopen if it breaks for you in normal usage.