Skip to content

Error parsing with mdx #585

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

Closed
m10rten opened this issue Nov 5, 2023 · 7 comments
Closed

Error parsing with mdx #585

m10rten opened this issue Nov 5, 2023 · 7 comments

Comments

@m10rten
Copy link

m10rten commented Nov 5, 2023

I got this log, it said to post a new Issue, I have replaced my username and projectname with and because I think that does not change this error.

It says Win 10, but it is Win 11 OS. I am using pnpm v8.6.6.
This is my package.json deps as well, before I show the full log:

  "dependencies": {
    "@ianvs/prettier-plugin-sort-imports": "4.1.1",
    "@radix-ui/react-dialog": "1.0.5",
    "@radix-ui/react-popover": "1.0.7",
    "@radix-ui/react-slot": "1.0.2",
    "@radix-ui/react-toast": "1.1.5",
    "class-variance-authority": "0.7.0",
    "clsx": "2.0.0",
    "contentlayer": "0.3.4",
    "geist": "1.0.0",
    "lucide-react": "0.291.0",
    "next": "14.0.1",
    "next-contentlayer": "0.3.4",
    "next-themes": "0.2.1",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "sharp": "0.32.6",
    "shiki": "0.14.5",
    "tailwind-merge": "2.0.0",
    "tailwindcss-animate": "1.0.7"
  },
  "devDependencies": {
    "@types/node": "20.8.10",
    "@types/react": "18.2.34",
    "@types/react-dom": "18.2.14",
    "autoprefixer": "10.4.16",
    "eslint": "8.52.0",
    "eslint-config-next": "14.0.1",
    "postcss": "8.4.31",
    "rehype": "13.0.1",
    "rehype-autolink-headings": "7.0.0",
    "rehype-pretty-code": "0.10.2",
    "rehype-slug": "6.0.0",
    "remark": "15.0.1",
    "remark-gfm": "4.0.0",
    "shadcn-ui": "0.4.1",
    "tailwindcss": "3.3.5",
    "ts-node": "10.9.1",
    "tsconfig": "workspace:*",
    "typescript": "5.2.2"
  }

With the following mdx file in: /content/docs/getting-started.mdx:

---
global_id: ""
title: Getting Started
nav_title: <project>- Getting Started
description: Get started with <project>
---

## Installation

```bash
npm install <project>
```

## Usage

In your routes files, you can use the <project> function to create a route handler.

This file then should look something like this:

```ts
import { <function> } from "<project>"; // Import the <functionality> function
```
[ERROR] TypeError: Cannot read properties of undefined (reading 'inTable')
    at Object.exitCodeText (file:///D:/Users/<user>/code/<project>/node_modules/.pnpm/[email protected]/node_modules/mdast-util-gfm-table/lib/index.js:123:17)
    at compile (file:///D:/Users/<user>/code/<project>/node_modules/.pnpm/[email protected]/node_modules/mdast-util-from-markdown/lib/index.js:352:40)
    at fromMarkdown (file:///D:/Users/<user>/code/<project>/node_modules/.pnpm/[email protected]/node_modules/mdast-util-from-markdown/lib/index.js:187:29)
    at parser (file:///D:/Users/<user>/code/<project>/node_modules/.pnpm/[email protected]/node_modules/remark-parse/lib/index.js:18:12)
    at Function.parse (file:///D:/Users/<user>/code/<project>/node_modules/.pnpm/[email protected]/node_modules/unified/lib/index.js:273:12)
    at executor (file:///D:/Users/<user>/code/<project>/node_modules/.pnpm/[email protected]/node_modules/unified/lib/index.js:393:31)
    at new Promise (<anonymous>)
    at Function.process (file:///D:/Users/<user>/code/<project>/node_modules/.pnpm/[email protected]/node_modules/unified/lib/index.js:380:14)
    at process (file:///D:/Users/<user>/code/<project>/node_modules/.pnpm/@[email protected]/node_modules/@mdx-js/mdx/lib/util/create-format-aware-processors.js:50:22)
    at onload (file:///D:/Users/<user>/code/<project>/node_modules/.pnpm/@[email protected][email protected]/node_modules/@mdx-js/esbuild/lib/index.js:151:22)
    at requestCallbacks.on-load (D:\Users\<user>\code\<project>\node_modules\.pnpm\[email protected]\node_modules\esbuild\lib\main.js:1434:28)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at handleRequest (D:\Users\<user>\code\<project>\node_modules\.pnpm\[email protected]\node_modules\esbuild\lib\main.js:729:13) [plugin @mdx-js/esbuild]

    _mdx_bundler_entry_point-8da94bdb-5343-40d9-adc1-5f8e6db4876f.mdx:0:0:
      0 │ ---
        ╵ ^

Error: Found 1 problems in 2 documents.

 └── Encountered unexpected errors while processing of 1 documents. This is possibly a bug in Contentlayer. Please open an issue.

     • "docs/getting-started.mdx": UnexpectedMDXError: Error: Build failed with 1 error:
     _mdx_bundler_entry_point-8da94bdb-5343-40d9-adc1-5f8e6db4876f.mdx:0:0: ERROR: [plugin: @mdx-js/esbuild] TypeError: Cannot read properties of undefined (reading 'inTable')
         at Object.exitCodeText (file:///D:/Users/<user>/code/<project>/node_modules/.pnpm/[email protected]/node_modules/mdast-util-gfm-table/lib/index.js:123:17)
         at compile (file:///D:/Users/<user>/code/<project>/node_modules/.pnpm/[email protected]/node_modules/mdast-util-from-markdown/lib/index.js:352:40)
         at fromMarkdown (file:///D:/Users/<user>/code/<project>/node_modules/.pnpm/[email protected]/node_modules/mdast-util-from-markdown/lib/index.js:187:29)
         at parser (file:///D:/Users/<user>/code/<project>/node_modules/.pnpm/[email protected]/node_modules/remark-parse/lib/index.js:18:12)
         at Function.parse (file:///D:/Users/<user>/code/<project>/node_modules/.pnpm/[email protected]/node_modules/unified/lib/index.js:273:12)
         at executor (file:///D:/Users/<user>/code/<project>/node_modules/.pnpm/[email protected]/node_modules/unified/lib/index.js:393:31)
         at new Promise (<anonymous>)
         at Function.process (file:///D:/Users/<user>/code/<project>/node_modules/.pnpm/[email protected]/node_modules/unified/lib/index.js:380:14)
         at process (file:///D:/Users/<user>/code/<project>/node_modules/.pnpm/@[email protected]/node_modules/@mdx-js/mdx/lib/util/create-format-aware-processors.js:50:22)
         at onload (file:///D:/Users/<user>/code/<project>/node_modules/.pnpm/@[email protected][email protected]/node_modules/@mdx-js/esbuild/lib/index.js:151:22)
         at requestCallbacks.on-load (D:\Users\<user>\code\<project>\node_modules\.pnpm\[email protected]\node_modules\esbuild\lib\main.js:1434:28)
         at processTicksAndRejections (node:internal/process/task_queues:95:5)
         at handleRequest (D:\Users\<user>\code\<project>\node_modules\.pnpm\[email protected]\node_modules\esbuild\lib\main.js:729:13)


SourceFetchDataError: {
  "_tag": "HandledFetchDataError"
}

File updated: docs/index.mdx
This error shouldn't have happened. Please consider opening a GitHub issue with the stack trace below here:
https://github.com/contentlayerdev/contentlayer/issues

An unchecked error was produced.

TypeError: Cannot read properties of undefined (reading 'cacheItemsMap')
    at IEffectTotal.effect (file:///D:/Users/<user>/code/<project>/node_modules/.pnpm/@[email protected][email protected]/node_modules/@contentlayer/source-files/src/fetchData/index.ts:187:19)
    at FiberContext.evaluateNow (file:///D:/Users/<user>/code/<project>/node_modules/.pnpm/@[email protected]/node_modules/@effect-ts/system/_src/Fiber/context.ts:940:54)
    at file:///D:/Users/<user>/code/<project>/node_modules/.pnpm/@[email protected]/node_modules/@effect-ts/system/_src/Fiber/context.ts:576:33
    at file:///D:/Users/<user>/code/<project>/node_modules/.pnpm/@[email protected]/node_modules/@effect-ts/system/_src/Support/Scheduler/index.ts:15:9
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

Fiber: #45 (started at: 2023-11-05T10:50:56.399Z) was supposed to continue to: <empty trace>

Fiber: #45 (started at: 2023-11-05T10:50:56.399Z) Execution trace: <empty trace>

Fiber: #45 (started at: 2023-11-05T10:50:56.399Z) was spawned by:

Fiber: #41 (started at: 2023-11-05T10:50:56.399Z) was supposed to continue to: <empty trace>

Fiber: #41 (started at: 2023-11-05T10:50:56.399Z) Execution trace: <empty trace>

Fiber: #41 (started at: 2023-11-05T10:50:56.399Z) was spawned by:

Fiber: #40 (started at: 2023-11-05T10:50:56.398Z) was supposed to continue to: <empty trace>

Fiber: #40 (started at: 2023-11-05T10:50:56.398Z) Execution trace: <empty trace>

Fiber: #40 (started at: 2023-11-05T10:50:56.398Z) was spawned by:

Fiber: #39 (started at: 2023-11-05T10:50:56.395Z) was supposed to continue to: <empty trace>

Fiber: #39 (started at: 2023-11-05T10:50:56.395Z) Execution trace: <empty trace>

Fiber: #39 (started at: 2023-11-05T10:50:56.395Z) was spawned by:

Fiber: #34 (started at: 2023-11-05T10:50:56.392Z) was supposed to continue to: <empty trace>

Fiber: #34 (started at: 2023-11-05T10:50:56.392Z) Execution trace: <empty trace>

Fiber: #34 (started at: 2023-11-05T10:50:56.392Z) was spawned by:

Fiber: #32 (started at: 2023-11-05T10:50:56.392Z) was supposed to continue to: <empty trace>

Fiber: #32 (started at: 2023-11-05T10:50:56.392Z) Execution trace: <empty trace>

Fiber: #32 (started at: 2023-11-05T10:50:56.392Z) was spawned by:

Fiber: #26 (started at: 2023-11-05T10:50:56.387Z) was supposed to continue to: <empty trace>

Fiber: #26 (started at: 2023-11-05T10:50:56.387Z) Execution trace: <empty trace>

Fiber: #26 (started at: 2023-11-05T10:50:56.387Z) was spawned by:

Fiber: #5 (started at: 2023-11-05T10:50:55.826Z) was supposed to continue to: <empty trace>

Fiber: #5 (started at: 2023-11-05T10:50:55.826Z) Execution trace: <empty trace>

Fiber: #5 (started at: 2023-11-05T10:50:55.826Z) was spawned by:

Fiber: #0 (started at: 2023-11-05T10:50:55.816Z) was supposed to continue to: <empty trace>

Fiber: #0 (started at: 2023-11-05T10:50:55.816Z) Execution trace: <empty trace>

Fiber: #0 (started at: 2023-11-05T10:50:55.816Z) was spawned by: <empty trace>

OS: win32 10.0.22621 (arch: x64)
Process: C:\Program Files\nodejs\node.exe D:\Users\<user>\code\<project>\node_modules\.pnpm\[email protected]_@[email protected]_@[email protected][email protected][email protected]\node_modules\next\dist\server\lib\start-server.js
Node version: v20.9.0
Contentlayer version: 0.3.4
@m10rten
Copy link
Author

m10rten commented Nov 5, 2023

My contentlayer.config.ts is almost identical to shadcn-taxonomy:contentlayer.config.js except it is TS and with less documenttypes and different fields.

@m10rten
Copy link
Author

m10rten commented Nov 5, 2023

It is related to: #560

@m10rten
Copy link
Author

m10rten commented Nov 5, 2023

Completely removing the remarkPlugins & remarkGfm from the contentlayer.config.ts cleared out the issue, so that is where it is it seems.

@h11g
Copy link

h11g commented Nov 12, 2023

I encountered the same problem when I used "remark-gfm": "^4.0.0"

@amankrx
Copy link

amankrx commented Nov 17, 2023

I'm facing the same issue. Any use of backticks in MDX results in this issue. And it is due to the remark-gfm as well. Any possible workaround to this?

@rafaelrcamargo
Copy link

Downgrading remark-gfm from ^4.0.0 to 3.0.1 solves this for now.

Copy link

stale bot commented Jan 20, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the meta: stale label Jan 20, 2024
@stale stale bot closed this as completed Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants