ERROR [unhandledRejection] Cannot read properties of undefined (reading 'mathFlowInside')
Environment
Nuxt project info: 18:45:21
- Operating System: Linux
- Node Version: v21.2.0
- Nuxt Version: 3.8.2
- CLI Version: 3.10.0
- Nitro Version: 2.8.0
- Package Manager: [email protected]
- Builder: -
- User Config: telemetry, srcDir, app, extends, modules, appConfig, runtimeConfig, vite, css, postcss, colorMode, device, image, content, pwa, robots, sitemap, site
- Runtime Modules: @nuxtjs/[email protected], @nuxtjs/[email protected], @nuxtjs/[email protected], @nuxtjs/[email protected], @nuxt/[email protected], @nuxt/[email protected], @vueuse/[email protected], @vite-pwa/[email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
- Build Modules: -
Reproduction
I update nuxt/content, rehype-katex and remark-math and then get an error on production build.
By removing the unnecessary stuff, I found out that the block below breaks the nuxt build in production mode.
$$
{\frac{x-x_a}{x_b-x_a} = \frac{y-y_a}{y_b-y_a}}
$$
Even code below not render.
$$
123
$$
In remark-math repo already have issue, but the developer responded to contact nuxt developers.
So, I just can't use new versions of nuxt/content or rehype-katex+remark-math newer then these:
"@nuxt/content": "^2.8.2", "rehype-katex": "^6.0.3", "remark-math": "^5.1.1",
Describe the bug
ERROR [unhandledRejection] Cannot read properties of undefined (reading 'mathFlowInside') 18:38:19
at Object.exitMathFlowFence (node_modules/.pnpm/[email protected]/node_modules/mdast-util-math/lib/index.js:96:19)
at compile (node_modules/.pnpm/[email protected]/node_modules/mdast-util-from-markdown/lib/index.js:352:40)
at fromMarkdown (node_modules/.pnpm/[email protected]/node_modules/mdast-util-from-markdown/lib/index.js:187:29)
at parser (node_modules/.pnpm/[email protected]/node_modules/remark-parse/lib/index.js:18:12)
at Function.parse (node_modules/.pnpm/[email protected]/node_modules/unified/lib/index.js:668:12)
at executor (node_modules/.pnpm/[email protected]/node_modules/unified/lib/index.js:734:40)
at new Promise (<anonymous>)
at Function.process (node_modules/.pnpm/[email protected]/node_modules/unified/lib/index.js:720:47)
at parseMarkdown (.nuxt/prerender/chunks/nitro/nitro-prerenderer.mjs:3325:41)
at async Object.parse (.nuxt/prerender/chunks/nitro/nitro-prerenderer.mjs:3423:20)
Additional context
No response
Logs
No response
@Sun-ZhenXing do you resolve this?
@Sun-ZhenXing do you resolve this?
@wokalek Not yet. I think it has something to do with the order of plugins parsed within the @nuxtjs/mdc.
If this isn't officially supported, it may have to be solved by starting with the source code.
remark-math uses remark^11 which is not supported by Content module yet. There is a breaking change between remark^10 and remark^11.
The upgrade is planned for the next version of @nuxtjs/mdc.
remark-mathusesremark^11which is not supported by Content module yet. There is a breaking change between remark^10 and remark^11. The upgrade is planned for the next version of@nuxtjs/mdc.
Good news! I'm really looking forward to it!
Thank you @wokalek !
@farnabaz I test "remark-math": "^5.1.1" and it work well!
Try my proj: algo-code-mgr. If you try, the warning you see is due to Vue not supporting MathML, and Vue will soon support MathML!
remark-mathusesremark^11which is not supported by Content module yet. There is a breaking change between remark^10 and remark^11. The upgrade is planned for the next version of@nuxtjs/mdc.
@farnabaz
Hello. I tried updating to the latest versions:
"@nuxt/content": "2.10.0",
"rehype-katex": "^7.0.0",
"remark-math": "^6.0.0",
and it didn't help. As far as I can see, @nuxtjs/mdc version has been updated inside nuxt/content to version 0.3.0.
So, no updates on this issue yet?
I updated it to everything new, the problem disappeared by itself. I think we can close it. None of the new users will encounter this problem anymore.
The $$ syntax no longer works for LaTeX
remark-math removed the $$ syntax in version v6 and replaced it with the math block.
Before you had to do this
$$
123
$$
Now you have to do this
```math
x^2
```
@dephraiim Thank you so much :), this saved me so much time, I couldn't figure out the issue before