Installed Math Plugin. But shows error when used

Bug report

I downloaded the Math plugin recently and when I tried to used it, it gave me this error:

Failed to render Markdown

Minified React error #321; visit https://reactjs.org/docs/error-decoder.html?invariant=321 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.

Environment

  • Platform: macOS
  • Platform version: Monterey/12.2.1
  • App Version: 5.4.3

How to reproduce

  1. Download math plugin
  2. Write syntax
  3. Go into Viewing Mode

Hi Luis,

Thank you for the report. That’s weird.
I need to reproduce the issue. Can you please share the reproduction Markdown code?
Have you installed any other plugins?

Hello Takuya
Thank you for your response. I tried the example in the Plugin-description.

$$
\int_0^\infty \frac{x^3}{e^x-1}\,dx = \frac{\pi^4}{15}
$$

I don’t have any other Plugins installed.

Thanks for the reproduction code. I’ve tried to reproduce it but can’t at the moment.

Can you please show me the error stack in the Developer Console? You can toggle it by Developer → Toggle Developer Tools from the menu. Please don’t forget to expand the stack.

Looks like you are on v5.4.3, which is the old version. Please try updating it to the latest version and try again.

I downloaded the new Version and still see the Error code.
Here are some Screenshots of the Developer Console:


Thanks for the information. Looks like the package react-katex is loaded from somewhere under your home directory /Users/luisgjokaj/...:

Screen Shot 2022-03-24 at 10.45.50

So perhaps you’ve installed that package globally via npm, which is incompatible with Inkdrop.
Can you please try uninstalling it?

I just uninstalled the package. It still does not work.

Now what does the error stack look like?

I thought i uninstalled it, but it looks like its still here.
I used npm uninstall -g @matejmazur/react-katex
I also used npm uninstall -g katex
and npm uninstall -g react-katex

Are these the wrong commands?

Yeah looks like it’s still there: /Users/luisgjokaj/Li...st/react-katex.js
You can search those files and remove them manually with rm -r command.

I tried this now. This is the new Error Stack:

What is index.tsx in the stack? It is nothing to do with the math plugin, so I don’t know why it’s loaded. Let me know the full path of it. You can click it to see its content.

I was having the same issue, I fixed it with the following:

  1. quit inkdrop (Q)

  2. rm -r /Users/$USER/Library/Application Support/inkdrop/packages/math

  3. npm uninstall react-katex

  4. ipm install math

Open up inkdrop and hopefully it works :slight_smile:

Thanks for the info!
The math plugin is using @matejmazur/react-katex instead of the original react-katex package. So, I don’t know why it is something to do with the issue :thinking:

Hello George and Takuya
I just tried what you recommended and it still does not work.
Here the Error stack:

You still have react-katex under your home directory:

Does that mean ipm installs react-katex in your home directory? Can you please tell me the exact path of that? I’m confused.

complete Path:
/Users/luisgjokaj/Library/Application Support/inkdrop/packages/math/node_modules/@matejmazur/react-katex/dist/react-katex.js

Got it. I guess you have the react package installed globally at a path something like /Users/luisgjokaj/node_modules/react:

So, there are duplicate React instances that cause the error.
Can you please try uninstalling it?

I just uninstalled react from node_modules and it seems like this was the problem that was causing the error. THANK YOU very much Takuya for your time and your help. :raised_hands:

Great! Thanks for your report as well!