Gruntfuggly / mermaid-export

A vscode extension to wrap mermaid.cli in order to export mermaid diagrams to image files
15 stars 4 forks source link

How to troubleshoot "Error: Chromium revision is not downloaded" #20

Open kdipippo opened 5 months ago

kdipippo commented 5 months ago

Writing this up in case others encounter this. This write-up could also be added to a troubleshooting section in the extension's README or somehow better handled in the code.

Error Message

After running Mermaid Export: Show Log and Mermaid Export: Export, the following error appears:

Mermaid Export ready
cwd:/Users/kdipippo/Desktop/exampledir
command:/Users/kdipippo/.vscode/extensions/gruntfuggly.mermaid-export-0.0.8/node_modules/.bin/mmdc -t default -i "/Users/kdipippo/Desktop/exampledir/examplefile.mermaid" -o "/Users/kdipippo/Desktop/exampledir/examplefile.png"
/Users/kdipippo/.vscode/extensions/gruntfuggly.mermaid-export-0.0.8/node_modules/puppeteer/lib/Launcher.js:119
        throw new Error(missingText);
              ^

Error: Chromium revision is not downloaded. Run "npm install" or "yarn install"
    at Launcher.launch (/Users/kdipippo/.vscode/extensions/gruntfuggly.mermaid-export-0.0.8/node_modules/puppeteer/lib/Launcher.js:119:15)

Node.js v22.2.0

OK

How to Fix

Thanks to this answer - https://stackoverflow.com/questions/53997175/puppeteer-error-chromium-revision-is-not-downloaded - the solution is to run the install command required by the puppeteer node library. The below commands would need to be updated to wherever the extension is downloaded on your machine:

cd /Users/kdipippo/.vscode/extensions/gruntfuggly.mermaid-export-0.0.8
node node_modules/puppeteer/install.js

Should return the messages:

Downloading Chromium r686378 - 110.2 Mb [====================] 100% 0.0s
Chromium downloaded to /Users/kdipippo/.vscode/extensions/gruntfuggly.mermaid-export-0.0.8/node_modules/puppeteer/.local-chromium/mac-686378