inkdropapp / inkdrop-math

Add math syntax support to markdown editor and preview
https://www.inkdrop.app/
MIT License
26 stars 7 forks source link

Bug: Failed to load math package #13

Closed Neihed closed 2 years ago

Neihed commented 2 years ago

If I start Inkdrop, I instantly get the error message: "Failed to load the math package. e.memo is not a function". The equations are not rendered correctly.

The currently installed version is v1.2.1.

craftzdog commented 2 years ago

Hi, thanks for the report. That's weird. Can you please fill the template below?

### Environment

- Platform: <!-- macOS/Windows/Ubuntu/iOS/Android -->
- Platform version: <!-- Big Sur/10/18.04 -->
- App Version: <!-- Make sure you are using the LATEST version: https://docs.inkdrop.app/releases/ -->

### Error

<!-- Please check if you got any error in the console log by selecting the menu: `Developer -> Toggle Developer Tools`. -->
Neihed commented 2 years ago

Environment

Error

app:error TypeError: e.memo is not a function at Object. (C:\Users\Nihad\AppData\Roaming\inkdrop\packages\math\node_modules\@matejmazur\react-katex\dist\react-katex.js:1:493) at Object. (C:\Users\Nihad\AppData\Roaming\inkdrop\packages\math\node_modules\@matejmazur\react-katex\dist\react-katex.js:4:3) at Module._compile (internal/modules/cjs/loader.js:1078:30) at Object.value [as .js] (file:///C:/Users/Nihad/AppData/Local/inkdrop/app-5.4.3/resources/app.asar/browser-main.js:1:579104) at Module.load (internal/modules/cjs/loader.js:935:32) at Module._load (internal/modules/cjs/loader.js:776:14) at Function.f._load (electron/js2c/asar_bundle.js:5:12913) at Function.o._load (electron/js2c/renderer_init.js:33:379) at Module.e.require (file:///C:/Users/Nihad/AppData/Local/inkdrop/app-5.4.3/resources/app.asar/browser-main.js:4:14023) at require (internal/modules/cjs/helpers.js:88:18) at Object. (C:\Users\Nihad\AppData\Roaming\inkdrop\packages\math\lib\react-math.js:21:13) at Object. (C:\Users\Nihad\AppData\Roaming\inkdrop\packages\math\lib\react-math.js:55:3) at Module._compile (internal/modules/cjs/loader.js:1078:30) at Object.value [as .js] (file:///C:/Users/Nihad/AppData/Local/inkdrop/app-5.4.3/resources/app.asar/browser-main.js:1:579104) at Module.load (internal/modules/cjs/loader.js:935:32) at Module._load (internal/modules/cjs/loader.js:776:14) at Function.f._load (electron/js2c/asar_bundle.js:5:12913) at Function.o._load (electron/js2c/renderer_init.js:33:379) at Module.e.require (file:///C:/Users/Nihad/AppData/Local/inkdrop/app-5.4.3/resources/app.asar/browser-main.js:4:14023) at require (internal/modules/cjs/helpers.js:88:18) at Object. (C:\Users\Nihad\AppData\Roaming\inkdrop\packages\math\lib\index.js:9:41) at Object. (C:\Users\Nihad\AppData\Roaming\inkdrop\packages\math\lib\index.js:56:3) at Module._compile (internal/modules/cjs/loader.js:1078:30) at Object.value [as .js] (file:///C:/Users/Nihad/AppData/Local/inkdrop/app-5.4.3/resources/app.asar/browser-main.js:1:579104) at Module.load (internal/modules/cjs/loader.js:935:32) at Module._load (internal/modules/cjs/loader.js:776:14) at Function.f._load (electron/js2c/asar_bundle.js:5:12913) at Function.o._load (electron/js2c/renderer_init.js:33:379) at Module.e.require (file:///C:/Users/Nihad/AppData/Local/inkdrop/app-5.4.3/resources/app.asar/browser-main.js:4:14023) at require (internal/modules/cjs/helpers.js:88:18) +1ms debug @ C:\Users\Nihad\AppData\Local\inkdrop\app-5.4.3\resources\app.asar\node_modules\debug\src\common.js:113

Neihed commented 2 years ago

Ok, I checked the problem. The e variable is referred to as the react package in the react-katex module. I guess the problem is that the react module is not up-to-date. React.memo was released in version 16.6.

The problem is that the react package is up-to-date (version 16.14.0): image

craftzdog commented 2 years ago

Thanks for the report. Yeah, looks like the plugin tries to load a different version of React for some reason. Have you installed an old version of React somewhere in the global scope on your computer? It could cause an issue like this. Please try uninstalling it.

Neihed commented 2 years ago

Unfortunately, I don't even have node.js and npm installed on my computer. And I also don't have React installed on my global scope.

craftzdog commented 2 years ago

I've tried to reinstall the math plugin on my Windows 10 machine but still can't reproduce the issue. I don't see React installed in the node_modules folder of the plugin here:

C:\Users\<USER>\AppData\Roaming\inkdrop\packages\math\node_modules

If you don't see it in that folder as well, you have to locate the path where the old React resides.

Neihed commented 2 years ago

Ok, I solved the issue. The react package was located in C:\Users\\node_modules. I deleted the whole node_modules folder.