contentlayer: TypeError: Cannot read properties of undefined (reading 'inTable')
Using Next.js v 13.5.1 I get this error when building the project
✘ [ERROR] TypeError: Cannot read properties of undefined (reading 'inTable')
at Object.exitCodeText (file:///Users/jahir/dev/jahir/website/node_modules/mdast-util-gfm-table/lib/index.js:123:17)
at compile (file:///Users/jahir/dev/jahir/website/node_modules/mdast-util-from-markdown/lib/index.js:353:40)
at fromMarkdown (file:///Users/jahir/dev/jahir/website/node_modules/mdast-util-from-markdown/lib/index.js:187:29)
at parser (file:///Users/jahir/dev/jahir/website/node_modules/@mdx-js/mdx/node_modules/remark-parse/lib/index.js:15:12)
at Function.parse (file:///Users/jahir/dev/jahir/website/node_modules/unified/lib/index.js:273:12)
at executor (file:///Users/jahir/dev/jahir/website/node_modules/unified/lib/index.js:393:31)
at new Promise (<anonymous>)
at Function.process (file:///Users/jahir/dev/jahir/website/node_modules/unified/lib/index.js:380:14)
at process (file:///Users/jahir/dev/jahir/website/node_modules/@mdx-js/mdx/lib/util/create-format-aware-processors.js:50:22)
at onload (file:///Users/jahir/dev/jahir/website/node_modules/@mdx-js/esbuild/lib/index.js:151:22) [plugin @mdx-js/esbuild]
_mdx_bundler_entry_point-a54d9f98-ef5f-4df9-8c0b-7c9b55c2c777.mdx:0:0:
0 │ ---
╵ ^
Error: Found 8 problems in 15 documents.
└── Encountered unexpected errors while processing of 8 documents. This is possibly a bug in Contentlayer. Please open an issue.
• "23-changes-in-2023.mdx": UnexpectedMDXError: Error: Build failed with 1 error:
_mdx_bundler_entry_point-b47e654d-45e4-405e-bc50-b36b47de128f.mdx:0:0: ERROR: [plugin: @mdx-js/esbuild] TypeError: Cannot read properties of undefined (reading 'inTable')
at Object.exitCodeText (file:///Users/jahir/dev/jahir/website/node_modules/mdast-util-gfm-table/lib/index.js:123:17)
at compile (file:///Users/jahir/dev/jahir/website/node_modules/mdast-util-from-markdown/lib/index.js:353:40)
at fromMarkdown (file:///Users/jahir/dev/jahir/website/node_modules/mdast-util-from-markdown/lib/index.js:187:29)
at parser (file:///Users/jahir/dev/jahir/website/node_modules/@mdx-js/mdx/node_modules/remark-parse/lib/index.js:15:12)
at Function.parse (file:///Users/jahir/dev/jahir/website/node_modules/unified/lib/index.js:273:12)
at executor (file:///Users/jahir/dev/jahir/website/node_modules/unified/lib/index.js:393:31)
at new Promise (<anonymous>)
at Function.process (file:///Users/jahir/dev/jahir/website/node_modules/unified/lib/index.js:380:14)
at process (file:///Users/jahir/dev/jahir/website/node_modules/@mdx-js/mdx/lib/util/create-format-aware-processors.js:50:22)
at onload (file:///Users/jahir/dev/jahir/website/node_modules/@mdx-js/esbuild/lib/index.js:151:22)
About this issue
- Original URL
- State: open
- Created 9 months ago
- Reactions: 19
- Comments: 20 (2 by maintainers)
Commits related to this issue
- fix: contentlayer not building issue linked here: https://github.com/contentlayerdev/contentlayer/issues/558 — committed to tygrxqt/tygr.dev by tygrxqt 9 months ago
- build(contentlayer): add remark-gfm plugin remark-gfm version pinned to 3.0.1 because of dependency issues in contentlayer/remark (cannot update to latest version 4.0.0). See: - https://github.com/c... — committed to chrjl/portfolio--react-singlepage by chrjl 8 months ago
- build(contentlayer): add remark-gfm plugin remark-gfm version pinned to 3.0.1 because of dependency issues in contentlayer/remark (cannot update to latest version 4.0.0). See: - https://github.com/c... — committed to chrjl/portfolio--contentlayer by chrjl 8 months ago
- chore(package.json): downgrade remark-gfm to fix uncaught error https://github.com/contentlayerdev/contentlayer/issues/558 — committed to plebbit/seedit by plebeius-eth 5 months ago
- post: mysql 트랜잭션 remark gfm 이슈 참고 https://github.com/contentlayerdev/contentlayer/issues/558 — committed to kyY00n/devlog by kyY00n 4 months ago
- Feat: dev/trouble-shooting md->mdx 5개 추가 및 트러블슈팅 ver: release/v1.2.0 ref: https://github.com/contentlayerdev/contentlayer/issues/558 — committed to Orchemi/huns-log by Orchemi 3 months ago
- Downgrade remark (https://github.com/contentlayerdev/contentlayer/issues/558) — committed to maccman/101-school by maccman 2 months ago
downgrading
remark-gfmto version 3.0.1 worked for meI updated my project and got these errors as well. Quickly jumped to blaming
next, but reverting all my updates and doing them one by one it seems that the actual causes of issues in my case are these four:If I upgrade
remark-gfmorremark-math, then I get same/similar errors to what’s mentioned in this issue. If I upgraderehype-highlightorrehype-katex, then I get another kind of error.It’s probably still this
contentlayerproject that needs to be updated somehow, since the errors come from either theycontentlayerconfig, or from processing the content pages, but yeah… It doesn’t seem to me thatnext@13.5is actually related here.My website is running with
next@13.5.2(latest) andcontentlayer@0.3.4(latest) now, without issues.Oh, this seems to be an issue with the latest
remark-gfmhttps://github.com/remarkjs/remark-gfm/issues/57Contentlayer probably needs updating its dependencies
+1, but I only have this problem on Vercel.
Running
pnpm next buildworks locally for me.But I get another error when running
pnpm contentlayer build:not stale (upgrades of
remark-gfmfrom v3 to v4 are still blocked)Any update about solution guys ? I get this error too
The changes are being propagated to the entire remark / rehype ecosystem.
contentlayerwould have to wait formdxandmdx-bundlerto be updated before it can be updated. In the meantime, just use the previous major version.I got the same error message since I upgraded my project to Next.js 13.5. I am looking forward it this issue will be fixed soon.
Confirm the issue.
it really works. I see the issue is happening when I try to write something in a code format.
...Seems like Contentlayer doesn’t support remark 15+ for now, if you take a look at their changelog, they also changed some typings. This also resulted in several type errors on my project, hope this will be fixed soon.
Worked for me, thanks @dewanshDT