jxnblk / mdx-deck

♠️ React MDX-based presentation decks
https://mdx-deck.jxnblk.com
MIT License
11.36k stars 603 forks source link

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

Open jorabra opened 4 years ago

jorabra commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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: