Skip to content
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

TypeError: Cannot read properties of undefined (reading 'inTable') #558

Open
jahirfiquitiva opened this issue Sep 19, 2023 · 20 comments · Fixed by timlrx/contentlayer2#1
Open

Comments

@jahirfiquitiva
Copy link
Contributor

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)
@alex289
Copy link

alex289 commented Sep 19, 2023

+1, but I only have this problem on Vercel.

Running pnpm next build works locally for me.

But I get another error when running pnpm contentlayer build:

❯ p contentlayer build
Generated 8 documents in .contentlayer
TypeError: The "code" argument must be of type number. Received an instance of Object
    at process.set [as exitCode] (node:internal/bootstrap/node:123:9)
    at Cli.runExit (/Users/alex/dev/Portfolio/node_modules/.pnpm/clipanion@3.2.1_typanion@3.13.0/node_modules/clipanion/lib/advanced/Cli.js:232:26)
    at run (file:///Users/alex/dev/Portfolio/node_modules/.pnpm/@contentlayer+cli@0.3.4_esbuild@0.18.13/node_modules/@contentlayer/cli/src/index.ts:39:3)
    at main (/Users/alex/dev/Portfolio/node_modules/.pnpm/contentlayer@0.3.4_esbuild@0.18.13/node_modules/contentlayer/bin/cli.cjs:5:3) {
  code: 'ERR_INVALID_ARG_TYPE'
}

@jahirfiquitiva
Copy link
Contributor Author

jahirfiquitiva commented Sep 19, 2023

Oh, this seems to be an issue with the latest remark-gfm
remarkjs/remark-gfm#57

Contentlayer probably needs updating its dependencies

@timtbdev
Copy link

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.

@Svish
Copy link

Svish commented Sep 21, 2023

I 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:

image

If I upgrade remark-gfm or remark-math, then I get same/similar errors to what's mentioned in this issue. If I upgrade rehype-highlight or rehype-katex, then I get another kind of error.

It's probably still this contentlayer project that needs to be updated somehow, since the errors come from either they contentlayer config, or from processing the content pages, but yeah... It doesn't seem to me that next@13.5 is actually related here.

My website is running with next@13.5.2 (latest) and contentlayer@0.3.4 (latest) now, without issues.

@jahirfiquitiva
Copy link
Contributor Author

@schickling any chance of getting a dependencies update soon? 🙏

@imyuanli
Copy link

imyuanli commented Sep 26, 2023

Many plugins have this similar error, remark math, rehype-highlight, remark codes and box, and soon

@dewanshDT
Copy link

downgrading remark-gfm to version 3.0.1 worked for me

@bradlocking
Copy link

downgrading remark-gfm to version 3.0.1 worked for me

Worked for me, thanks @dewanshDT

@fuma-nama
Copy link

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.

@sohanemon
Copy link

downgrading remark-gfm to version 3.0.1 worked for me

it really works. I see the issue is happening when I try to write something in a code format. ...

@tygrxqt
Copy link

tygrxqt commented Oct 14, 2023

remark-gfm@4.0 works for me, however rehype-pretty-code@0.10.1 does not

@timlrx
Copy link

timlrx commented Oct 17, 2023

The changes are being propagated to the entire remark / rehype ecosystem. contentlayer would have to wait for mdx and mdx-bundler to be updated before it can be updated. In the meantime, just use the previous major version.

@omins omins mentioned this issue Oct 30, 2023
chrjl added a commit to chrjl/portfolio--react-singlepage that referenced this issue Nov 12, 2023
remark-gfm version pinned to 3.0.1 because of dependency issues in
contentlayer/remark (cannot update to latest version 4.0.0).

See:
- contentlayerdev/contentlayer#558
- remarkjs/remark-gfm#57
@RMahammad
Copy link

Any update about solution guys ? I get this error too

chrjl added a commit to chrjl/portfolio--contentlayer that referenced this issue Nov 21, 2023
remark-gfm version pinned to 3.0.1 because of dependency issues in
contentlayer/remark (cannot update to latest version 4.0.0).

See:
- contentlayerdev/contentlayer#558
- remarkjs/remark-gfm#57
@jaswrks
Copy link

jaswrks commented Nov 26, 2023

Parsing error: Cannot set properties of undefined (setting 'inTable') eslint

Still getting this error after updating to:

"@mdx-js/mdx": "^3.0.0",

        "remark": "^15.0.1",
        "remark-directive": "^3.0.0",
        "remark-frontmatter": "^5.0.0",
        "remark-gfm": "^4.0.0",
        "remark-lint": "^9.1.2",
        "remark-mdx-frontmatter": "^4.0.0",
        "remark-mermaidjs": "^6.0.0",
        "remark-preset-lint-recommended": "^6.1.3",
        "remark-preset-prettier": "^2.0.1",
        "remark-smartypants": "^2.0.0",
---
Foo: Bar
---

| First Header  | Second Header |
| ------------- | ------------- |
| Content Cell  | Content Cell  |
| Content Cell  | Content Cell  |

Markup on 2023-11-26 at 01:28:43

Copy link

stale bot commented Jan 25, 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 25, 2024
@kachkaev
Copy link

kachkaev commented Jan 29, 2024

not stale (upgrades of remark-gfm from v3 to v4 are still blocked)

@stale stale bot removed the meta: stale label Jan 29, 2024
This was referenced Feb 2, 2024
@rusakovic
Copy link

Confirm the issue.

#12 4.739 ✘ [ERROR] TypeError: Cannot read properties of undefined (reading 'inTable')
#12 4.739 at Object.exitCodeText (file:///app/node_modules/.pnpm/mdast-util-gfm-table@2.0.0/node_modules/mdast-util-gfm-table/lib/index.js:123:17)
#12 4.739 at compile (file:///app/node_modules/.pnpm/mdast-util-from-markdown@1.3.1/node_modules/mdast-util-from-markdown/lib/index.js:352:40)
#12 4.739 at fromMarkdown (file:///app/node_modules/.pnpm/mdast-util-from-markdown@1.3.1/node_modules/mdast-util-from-markdown/lib/index.js:187:29)
#12 4.739 at parser (file:///app/node_modules/.pnpm/remark-parse@10.0.2/node_modules/remark-parse/lib/index.js:18:12)
#12 4.739 at Function.parse (file:///app/node_modules/.pnpm/unified@10.1.2/node_modules/unified/lib/index.js:273:12)
#12 4.739 at executor (file:///app/node_modules/.pnpm/unified@10.1.2/node_modules/unified/lib/index.js:393:31)
#12 4.739 at new Promise (<anonymous>)
#12 4.739 at Function.process (file:///app/node_modules/.pnpm/unified@10.1.2/node_modules/unified/lib/index.js:380:14)
#12 4.739 at process (file:///app/node_modules/.pnpm/@mdx-js+mdx@2.3.0/node_modules/@mdx-js/mdx/lib/util/create-format-aware-processors.js:50:22)
#12 4.739 at onload (file:///app/node_modules/.pnpm/@mdx-js+esbuild@2.3.0_esbuild@0.20.0/node_modules/@mdx-js/esbuild/lib/index.js:151:22) [plugin @mdx-js/esbuild]

kyY00n added a commit to kyY00n/devlog that referenced this issue Feb 17, 2024
@whale2002
Copy link

downgrading remark-gfm to version 3.0.1 worked for me

thank you, it works!!!

@naymurdev
Copy link

3.0.1

did you solve it

+1, but I only have this problem on Vercel.

Running pnpm next build works locally for me.

But I get another error when running pnpm contentlayer build:

❯ p contentlayer build
Generated 8 documents in .contentlayer
TypeError: The "code" argument must be of type number. Received an instance of Object
    at process.set [as exitCode] (node:internal/bootstrap/node:123:9)
    at Cli.runExit (/Users/alex/dev/Portfolio/node_modules/.pnpm/clipanion@3.2.1_typanion@3.13.0/node_modules/clipanion/lib/advanced/Cli.js:232:26)
    at run (file:///Users/alex/dev/Portfolio/node_modules/.pnpm/@contentlayer+cli@0.3.4_esbuild@0.18.13/node_modules/@contentlayer/cli/src/index.ts:39:3)
    at main (/Users/alex/dev/Portfolio/node_modules/.pnpm/contentlayer@0.3.4_esbuild@0.18.13/node_modules/contentlayer/bin/cli.cjs:5:3) {
  code: 'ERR_INVALID_ARG_TYPE'
}

did you find any solution?

Orchemi added a commit to Orchemi/huns-log that referenced this issue Apr 3, 2024
@aikins01
Copy link

aikins01 commented Apr 6, 2024

still have to be on remark-gfm 3.0.1

maccman added a commit to maccman/101-school that referenced this issue Apr 18, 2024
nuta added a commit to nuta/operating-system-in-1000-lines that referenced this issue May 11, 2024
algasami added a commit to algasami/algasami.github.io that referenced this issue May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.