question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

build script fails with syntax errors in `gatsby-plugin-mdx` after upgrade to 3.0.8

See original GitHub issue

I upgraded from 1.7.x to 3.0.8, and am unable to build. I reviewed the upgrading document, and fixed a number of issues listed there, but unfortunately can’t see a match between this error and any of the listed things to do when upgrading.

Anybody else have this issue? Could easily be user error but mdx-deck is the only thing I use MDX for and don’t readily see the boundary between what it is responsible for, and its dependencies.

i have an error output like this:

yarn run build
yarn run v1.17.3
$ mdx-deck build deck.mdx
info Deleting .cache, public
info Successfully deleted directories

success open and validate gatsby-configs - 0.035 s
success load plugins - 0.279 s
success onPreInit - 0.013 s
success delete html and css files from previous builds - 0.014 s
success initialize cache - 0.017 s
success copy gatsby files - 0.037 s
success onPreBootstrap - 0.020 s
success source and transform nodes - 0.518 s
success building schema - 0.156 s
success createPages - 0.168 s
success createPagesStatefully - 0.021 s
success onPreExtractQueries - 0.010 s
success update schema - 0.038 s
success extract queries from components - 0.100 s
success write out requires - 0.014 s
success write out redirect data - 0.011 s
success onPostBootstrap - 0.013 s
⠀
info bootstrap finished - 2.787 s
⠀
success run static queries - 0.013 s
success Building production JavaScript and CSS bundles - 7.862 s
success Rewriting compilation hashes - 0.017 s
success run page queries - 0.038 s — 2/2 124.17 queries/second

 ERROR #95313

Building static HTML failed for path "/"

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


  29 |       const keys = Object.keys(fullScope);
  30 |       const values = keys.map(key => fullScope[key]);
> 31 |       const fn = new Function("_fn", ...keys, `${children}`);
     |               ^
  32 |
  33 |       return fn({}, ...values);
  34 |     },


  WebpackError: SyntaxError: Unexpected token export

  - mdx-renderer.js:31
    gatsby-plugin-mdx/mdx-renderer.js:31:15

  - mdx-renderer.js:15 MDXRenderer
    gatsby-plugin-mdx/mdx-renderer.js:15:15


⠇ Building static HTML for pages
(node:71658) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Error: Command failed with exit code 1 (EPERM): gatsby build
    at makeError (/Users/eve/workspace/decks/algorand-primer/node_modules/mdx-deck/node_modules/execa/lib/error.js:58:11)
    at handlePromise (/Users/eve/workspace/decks/algorand-primer/node_modules/mdx-deck/node_modules/execa/index.js:112:26)
    at processTicksAndRejections (internal/process/task_queues.js:85:5)
error Command failed with exit code 1.

unfortunately I am not so familiar with Webpack. if this is not appropriate issue here please let me know and I can direct my efforts elsewhere.

thank you very much!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
mattiashcommented, Aug 30, 2019

Thanks @michaellopez for the workaround. I can confirm that it works for me.

1reaction
mattiashcommented, Aug 10, 2019

I think I have the same problem. I have built a small sample presentation to show the problem:

https://github.com/mattiash/presentation

I am trying to use a custom theme. Without the line

export { theme } from './theme.js'

in deck.mdx it builds fine, but with this line npm run build fails with

WebpackError: SyntaxError: Unexpected token export
Read more comments on GitHub >

github_iconTop Results From Across the Web

error "gatsby-plugin-mdx" threw an error while running the ...
The error from npm run build. "gatsby-plugin-mdx" threw an error while running the onCreateNode lifecycle: unknown: Unexpected token, expected " ...
Read more >
Troubleshooting Common Errors - Gatsby
Errors using gatsby-plugin-image and sharp · Field “image” must not have a selection since type “String” has no subfields · Problems installing sharp...
Read more >
Why am I getting an error message when I try to deploy my ...
I have a Gatsby app. When I build it locally, it works fine, but when I try to deploy it to Netlify or...
Read more >
gatsby-plugin-mdx | Yarn - Package Manager
It lets you write JSX embedded inside markdown. It's a great combination because it allows you to use markdown's often terse syntax (such...
Read more >
How to Build a Developer Blog with Gatsby and MDX - SitePoint
I'll be going from a Hello, World! Gatsby project through to a coding blog with code syntax highlighting and a theme toggle for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found