Skip to content

Mermaid 9.2 falls over in Docusaurus 2.2 #8274

@xenon8

Description

@xenon8

Have you read the Contributing Guidelines on issues?

Prerequisites

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn error in the Docusaurus core causing instability or issues with its execution

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions