gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.27k stars 10.31k forks source link

[gatsby-plugin-mdx] helpers(...).ensure is not a function #20350

Closed dylanjha closed 4 years ago

dylanjha commented 4 years ago

Description

Getting this error when running gatsby develop.

Steps to reproduce

I don't have reproducible steps because this is a private project :(. I'll happily provide whatever more info I can to help move this along. It appears this is more of a babel issue.

Expected result

gatsby develop should succeed

Actual result

gatsby develop throws an error, tracing back to gatsby-plugin-mdx

Environment

  System:
    OS: macOS 10.15.1
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 8.16.0 - /var/folders/4n/nd5y3s7x00gbr3mk4fq0jv4c0000gn/T/fnm-shell-5652938/bin/node
    Yarn: 1.19.1 - /usr/local/bin/yarn
    npm: 6.13.0 - /var/folders/4n/nd5y3s7x00gbr3mk4fq0jv4c0000gn/T/fnm-shell-5652938/bin/npm
  Languages:
    Python: 2.7.17 - /usr/local/bin/python
  Browsers:
    Chrome: 79.0.3945.88
    Firefox: 70.0.1
    Safari: 13.0.3
  npmPackages:
    gatsby: ^2.18.13 => 2.18.13 
    gatsby-cli: ^2.4.11 => 2.4.11 
    gatsby-image: ^2.0.29 => 2.2.37 
    gatsby-link: ^2.0.11 => 2.0.11 
    gatsby-plugin-canonical-urls: ^2.0.12 => 2.0.12 
    gatsby-plugin-catch-links: ^2.0.11 => 2.0.11 
    gatsby-plugin-google-tagmanager: ^2.0.9 => 2.0.9 
    gatsby-plugin-intercom-spa: ^0.1.0 => 0.1.0 
    gatsby-plugin-layout: ^1.0.12 => 1.1.18 
    gatsby-plugin-mdx: ^1.0.62 => 1.0.62 
    gatsby-plugin-netlify: ^2.0.11 => 2.0.11 
    gatsby-plugin-react-helmet: ^3.0.6 => 3.0.6 
    gatsby-plugin-sharp: ^2.3.9 => 2.3.9 
    gatsby-plugin-sitemap: ^2.0.5 => 2.0.5 
    gatsby-plugin-styled-components: ^3.0.6 => 3.0.6 
    gatsby-remark-autolink-headers: ^2.0.14 => 2.0.14 
    gatsby-remark-prismjs: ^3.2.4 => 3.2.4 
    gatsby-source-airtable: ^2.0.10 => 2.0.10 
    gatsby-source-filesystem: ^2.1.38 => 2.1.38 
    gatsby-source-sanity: ^5.0.4 => 5.0.4 
    gatsby-transformer-remark: ^2.2.5 => 2.2.5 
    gatsby-transformer-sharp: ^2.1.14 => 2.3.9 
  npmGlobalPackages:
    gatsby-cli: 2.7.30

Here's the full stack trace:

9:44:55 AM: error "gatsby-plugin-mdx" threw an error while running the onCreateNode lifecycle:
9:44:55 AM: unknown: helpers(...).ensure is not a function
9:44:55 AM: 
9:44:55 AM:   TypeError: unknown: helpers(...).ensure is not a function
9:44:55 AM:   
9:44:55 AM:   - file.js:203 File.addHelper
9:44:55 AM:     [repo]/[@babel]/core/lib/transformation/file/file.js:203:15
9:44:55 AM:   
9:44:55 AM:   - plugin-pass.js:31 PluginPass.addHelper
9:44:55 AM:     [repo]/[@babel]/core/lib/transformation/plugin-pass.js:31:22
9:44:55 AM:   
9:44:55 AM:   - index.js:168 createObjectSpread
9:44:55 AM:     [repo]/[@babel]/plugin-proposal-object-rest-spread/lib/index.js:168:102
9:44:55 AM:   
9:44:55 AM:   - index.js:246 VariableDeclarator.path
9:44:55 AM:     [repo]/[@babel]/plugin-proposal-object-rest-spread/lib/index.js:246:81
9:44:55 AM:   
9:44:55 AM:   - context.js:55 NodePath._call
9:44:55 AM:     [repo]/[core]/[@babel]/traverse/lib/path/context.js:55:20
9:44:55 AM:   
9:44:55 AM:   - context.js:42 NodePath.call
9:44:55 AM:     [repo]/[core]/[@babel]/traverse/lib/path/context.js:42:17
9:44:55 AM:   
9:44:55 AM:   - context.js:90 NodePath.visit
9:44:55 AM:     [repo]/[core]/[@babel]/traverse/lib/path/context.js:90:31
9:44:55 AM:   
9:44:55 AM:   - context.js:112 TraversalContext.visitQueue
9:44:55 AM:     [repo]/[core]/[@babel]/traverse/lib/context.js:112:16
9:44:55 AM:   
9:44:55 AM:   - context.js:79 TraversalContext.visitMultiple
9:44:55 AM:     [repo]/[core]/[@babel]/traverse/lib/context.js:79:17
9:44:55 AM:   
9:44:55 AM:   - context.js:138 TraversalContext.visit
9:44:55 AM:     [repo]/[core]/[@babel]/traverse/lib/context.js:138:19
9:44:55 AM:   
9:44:55 AM:   - index.js:84 Function.traverse.node
9:44:55 AM:     [repo]/[core]/[@babel]/traverse/lib/index.js:84:17
9:44:55 AM:   
9:44:55 AM:   - index.js:66 traverse
9:44:55 AM:     [repo]/[core]/[@babel]/traverse/lib/index.js:66:12
9:44:55 AM:   
9:44:55 AM:   - index.js:148 NodePath.traverse
9:44:55 AM:     [repo]/[core]/[@babel]/traverse/lib/path/index.js:148:24
9:44:55 AM:   
9:44:55 AM:   - index.js:62 visitRestElements
9:44:55 AM:     [repo]/[@babel]/plugin-proposal-object-rest-spread/lib/index.js:62:10
9:44:55 AM:   
9:44:55 AM:   - index.js:215 PluginPass.VariableDeclarator
9:44:55 AM:     [repo]/[@babel]/plugin-proposal-object-rest-spread/lib/index.js:215:9
9:44:55 AM:   
9:44:55 AM:   - visitors.js:179 newFn
9:44:55 AM:     [repo]/[core]/[@babel]/traverse/lib/visitors.js:179:21
9:44:55 AM:   
9:44:55 AM:   - context.js:55 NodePath._call
9:44:55 AM:     [repo]/[core]/[@babel]/traverse/lib/path/context.js:55:20
9:44:55 AM:   
9:44:55 AM:   - context.js:42 NodePath.call
9:44:55 AM:     [repo]/[core]/[@babel]/traverse/lib/path/context.js:42:17
9:44:55 AM:   
9:44:55 AM:   - context.js:90 NodePath.visit
9:44:55 AM:     [repo]/[core]/[@babel]/traverse/lib/path/context.js:90:31
9:44:55 AM:   
9:44:55 AM:   - context.js:112 TraversalContext.visitQueue
9:44:55 AM:     [repo]/[core]/[@babel]/traverse/lib/context.js:112:16
9:44:55 AM:   
9:44:55 AM:   - context.js:79 TraversalContext.visitMultiple
9:44:55 AM:     [repo]/[core]/[@babel]/traverse/lib/context.js:79:17
9:44:55 AM:   
9:44:55 AM:   - context.js:138 TraversalContext.visit
9:44:55 AM:     [repo]/[core]/[@babel]/traverse/lib/context.js:138:19
9:44:55 AM:   
9:44:55 AM:   - index.js:84 Function.traverse.node
9:44:55 AM:     [repo]/[core]/[@babel]/traverse/lib/index.js:84:17
9:44:55 AM:   
9:44:55 AM:   - context.js:97 NodePath.visit
9:44:55 AM:     [repo]/[core]/[@babel]/traverse/lib/path/context.js:97:18
9:44:55 AM:   
9:44:55 AM:   - context.js:112 TraversalContext.visitQueue
9:44:55 AM:     [repo]/[core]/[@babel]/traverse/lib/context.js:112:16
9:44:55 AM:   
9:44:55 AM:   - context.js:79 TraversalContext.visitMultiple
9:44:55 AM:     [repo]/[core]/[@babel]/traverse/lib/context.js:79:17
9:44:55 AM:   
9:44:55 AM:   - context.js:138 TraversalContext.visit
9:44:55 AM:     [repo]/[core]/[@babel]/traverse/lib/context.js:138:19
9:44:55 AM:   
9:44:55 AM:   - index.js:84 Function.traverse.node
9:44:55 AM:     [repo]/[core]/[@babel]/traverse/lib/index.js:84:17
9:44:55 AM:   
9:44:55 AM:   - context.js:97 NodePath.visit
9:44:55 AM:     [repo]/[core]/[@babel]/traverse/lib/path/context.js:97:18
9:44:55 AM:   
9:44:55 AM:   - context.js:112 TraversalContext.visitQueue
9:44:55 AM:     [repo]/[core]/[@babel]/traverse/lib/context.js:112:16
9:44:55 AM:   
9:44:55 AM:   - context.js:84 TraversalContext.visitSingle
9:44:55 AM:     [repo]/[core]/[@babel]/traverse/lib/context.js:84:19
9:44:55 AM:   
9:44:55 AM:   - context.js:140 TraversalContext.visit
9:44:55 AM:     [repo]/[core]/[@babel]/traverse/lib/context.js:140:19
9:44:55 AM:   
9:44:55 AM:   - index.js:84 Function.traverse.node
9:44:55 AM:     [repo]/[core]/[@babel]/traverse/lib/index.js:84:17
9:44:55 AM:   
9:44:55 AM:   - context.js:97 NodePath.visit
9:44:55 AM:     [repo]/[core]/[@babel]/traverse/lib/path/context.js:97:18
tw1t611 commented 4 years ago

Hi,

this may be related to #10266.

The solution could be:

we removed node_modules and webpack build cache, and it is solved

A reproduction really is needed for the devs to examine your problem. This guide helps you to build a minimal reproduction: https://www.gatsbyjs.org/contributing/how-to-make-a-reproducible-test-case/

dylanjha commented 4 years ago

Yep. It is that babel issue. Thanks for linking it up.