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

A page component must export a React component for it to be valid #728

Open
jorabra opened this issue Jun 8, 2020 · 2 comments
Open

A page component must export a React component for it to be valid #728

jorabra opened this issue Jun 8, 2020 · 2 comments

Comments

@jorabra
Copy link

jorabra commented Jun 8, 2020

When running md-deck build deck.mdx on a clean mdx-deck (v4.1.1) setup the process errors out with the following message:

> mdx-deck build deck.mdx

info Deleting .cache, public
info Successfully deleted directories
success open and validate gatsby-configs - 0.021s
success load plugins - 0.071s
success onPreInit - 0.002s
success delete html and css files from previous builds - 0.011s
success initialize cache - 0.007s
success copy gatsby files - 0.033s
success onPreBootstrap - 0.013s
success createSchemaCustomization - 0.003s
success source and transform nodes - 0.035s
success building schema - 0.179s

 ERROR #11328

A page component must export a React component for it to be valid. Please make sure this file exports a React component:

undefined

not finished createPages - 0.011s
Error: Command failed with exit code 1: gatsby build
    at makeError (/Users/jorabra/source/decks/test-mdx-deck-take2/node_modules/execa/lib/error.js:59:11)
    at handlePromise (/Users/jorabra/source/decks/test-mdx-deck-take2/node_modules/execa/index.js:114:26)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

package.json

{
  "name": "test-mdx-deck",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "mdx-deck deck.mdx",
    "build": "mdx-deck build deck.mdx"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "mdx-deck": "^4.1.1"
  }
}

deck.mdx

# Hello

---

Second slide

Node versions

node: v12.18.0
npm: 6.14.4
@JulesBlm
Copy link

According to this issue in the DoczJS repo, the issue is with GatsbyJS. I added the latest version of Gatsby manually with npm i gatsby@2.23.3 which seemed to fix this problem.

@johncalvinroberts
Copy link

I also ran into this problem, and tried the solution mentioned by @JulesBlm

In case anyone sees this and is stuck: I had to take it a step further in order to get it to build, using yarn resolutions:

  • yarn add gatsby@2.23.4
  • Add this to package.json ->
{
...
  "resolutions": {
    "gatsby": "2.23.4"
  }
}
  • yarn install again
  • Should build successfully

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants