Troubleshooting
Generating diagrams relies on Puppeteer (Headless Chrome) and the Mermaid CLI. Differences in operating systems and Node environments can sometimes cause issues.
ARM64 Users (Apple Silicon M1/M2/M3)
Puppeteer may not automatically install a compatible version of Chromium for ARM64 architectures. If you encounter errors on MacOS:
-
Install Chromium via Brew:
brew install --cask --no-quarantine chromium -
Verify the path:
which chromium # Output usually: /opt/homebrew/bin/chromium
The generator attempts to automatically detect the Chromium path on ARM64 MacOS. If it fails, or if you are on Linux ARM64, you can force the path using variables:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
PUPPETEER_EXECUTABLE_PATH=$(which chromium)
Yarn 3+ (Plug'n'Play)
Yarn 3+ with PnP does not create a standard node_modules/.bin folder, which prevents the generator from finding the mmdc executable.
Solution:
-
Create a shell script named
mmdcin your project root:#!/bin/bash yarn mmdc $@ -
Make it executable:
chmod +x mmdc -
Point the generator to this script:
generator erd { provider = "prisma-erd-generator" mmdcPath = "./mmdc" }
General Debugging
If generation fails silently or produces weird output:
-
Try Markdown Output: Change
outputtoERD.md. This skips the Puppeteer rendering step. If this works, the issue is likely with Puppeteer/Chrome setup on your machine. -
Enable Debug Mode: Run with
ERD_DEBUG=true.
Check theERD_DEBUG=true npx prisma generateprisma/debugfolder. It will contain:1-datamodel.json: The parsed Prisma DMMF.3-mermaid.mmd: The generated Mermaid diagram syntax.
You can copy the content of
3-mermaid.mmdinto the Mermaid Live Editor to verify if the syntax is valid.