Open jahirfiquitiva opened 11 months ago
+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'
}
Oh, this seems to be an issue with the latest remark-gfm
https://github.com/remarkjs/remark-gfm/issues/57
Contentlayer probably needs updating its dependencies
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.
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:
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.
@schickling any chance of getting a dependencies update soon? 🙏
Many plugins have this similar error, remark math, rehype-highlight, remark codes and box, and soon
downgrading remark-gfm
to version 3.0.1 worked for me
downgrading
remark-gfm
to version 3.0.1 worked for me
Worked for me, thanks @dewanshDT
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.
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. ...
remark-gfm@4.0
works for me, however rehype-pretty-code@0.10.1
does not
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.
Any update about solution guys ? I get this error too
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 |
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.
not stale (upgrades of remark-gfm
from v3 to v4 are still blocked)
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]
downgrading
remark-gfm
to version 3.0.1 worked for me
thank you, it works!!!
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?
still have to be on remark-gfm 3.0.1
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.
not stale
No update yet? :(
@nvegater I have managed to mitigate this issue by temporarily switching to a fork: https://github.com/timlrx/contentlayer2. Context: https://github.com/contentlayerdev/contentlayer/issues/651#issuecomment-2030335434.
UPD (2024-07-07) I switched to https://github.com/zce/velite and it’s even better!
downgrading
remark-gfm
to version 3.0.1 worked for me
Thanks , it works!
downgrading
remark-gfm
to version 3.0.1 worked for me
Thank you it works.
it looks like we still have to use remark-gfm@3.0.1
Using Next.js v
13.5.1
I get this error when building the project