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

Mermaid 9.2 falls over in Docusaurus 2.2 #8274

Closed
6 of 7 tasks
xenon8 opened this issue Nov 1, 2022 · 2 comments · Fixed by #8282
Closed
6 of 7 tasks

Mermaid 9.2 falls over in Docusaurus 2.2 #8274

xenon8 opened this issue Nov 1, 2022 · 2 comments · Fixed by #8282
Labels
bug An error in the Docusaurus core causing instability or issues with its execution

Comments

@xenon8
Copy link

xenon8 commented Nov 1, 2022

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

Description

We get the below error when following the instructions here to implement Mermaid with Docusaurus 2.2

TypeError: Cannot read properties of undefined (reading 'mermaidAPI')

The error occurs when loading a page with a Mermaid diagram on it.

After some investigation it would appear that Mermaid 9.2 was released today and this caused the issue.

To resolve it, when added this to the package.json:
"mermaid": "9.1.1",

rather than

"mermaid": "^9.1.1",

I have reproduced the issue on a fresh site as well as our own

Reproducible demo

No response

Steps to reproduce

  1. Create new site of docusaurus
  2. add the Mermaid changes as per the documentation
  3. make a page with mermaid in them (add the ticks):

mermaid
graph LR
A[Build your site] --> B[Deploy your site]

  1. install npm packages
  2. start site
  3. navigate to page

Expected behavior

page loads

Actual behavior

page crashes with:

TypeError: Cannot read properties of undefined (reading 'mermaidAPI')

Your environment

  • Docusaurus version used: 2.2.
  • Environment name and version (e.g. Chrome 89, Node.js 16.4): Edge (106.0.1370.52 64bit); Node 16.15.0
  • Operating system and version (e.g. Ubuntu 20.04.2 LTS): Windows 10 21H2

Self-service

  • I'd be willing to fix this bug myself.
@xenon8 xenon8 added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Nov 1, 2022
@slorber
Copy link
Collaborator

slorber commented Nov 2, 2022

Thanks for reporting, can confirm something weird is happening.

See also:

@slorber slorber removed the status: needs triage This issue has not been triaged by maintainers label Nov 2, 2022
@slorber
Copy link
Collaborator

slorber commented Nov 10, 2022

Fixed in Mermaid 9.2.2

You can remove override/resolution and just upgrade mermaid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants