mermaid-js / mermaid-cli

Command line tool for the Mermaid library
MIT License
2.39k stars 227 forks source link

Could not find Chromium (rev. 1108766) #671

Open raffaem opened 6 months ago

raffaem commented 6 months ago

Describe the bug

Install with:

sudo npm install -g @mermaid-js/mermaid-cli

Get warning about puppeteer at install:

npm WARN deprecated puppeteer@19.11.1: < 21.8.0 is no longer supported

Create input.mmd as:

flowchart LR
  A-->B

Launch

mmdc -i input.mmd -o input.png

Get

➜  mmdc -i input.mmd -o input.png

Error: Could not find Chromium (rev. 1108766). This can occur if either
 1. you did not perform an installation before running the script (e.g. `npm install`) or
 2. your cache path is incorrectly configured (which is: /home/raffaele/.cache/puppeteer).
For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides/configuration.
    at ChromeLauncher.resolveExecutablePath (file:///usr/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/puppeteer-core/lib/esm/puppeteer/node/ProductLauncher.js:263:27)
    at ChromeLauncher.executablePath (file:///usr/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/puppeteer-core/lib/esm/puppeteer/node/ChromeLauncher.js:176:25)
    at ChromeLauncher.computeLaunchArguments (file:///usr/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/puppeteer-core/lib/esm/puppeteer/node/ChromeLauncher.js:93:37)
    at async ChromeLauncher.launch (file:///usr/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/puppeteer-core/lib/esm/puppeteer/node/ProductLauncher.js:57:28)
    at async run (file:///usr/lib/node_modules/@mermaid-js/mermaid-cli/src/index.js:404:19)
    at async cli (file:///usr/lib/node_modules/@mermaid-js/mermaid-cli/src/index.js:184:3)

[ble: exit 1]

Same error as #650, but I don't have a "mermaid" software as described in the workaround that that OP used

To Reproduce

See above

Expected behavior

Should produce PNG file.

Desktop (please complete the following information):

raffaem commented 6 months ago

Downgrading to 9.1.7 with:

sudo npm install -g @mermaid-js/mermaid-cli@9.1.7

makes mmdc work again.

saiwing-yeung commented 5 months ago

Same issue for me. Downgrading to 9.1.7 also worked.

raffaem commented 5 months ago

Still same issue. @mermaid-js any ideas?

aloisklink commented 5 months ago

Still same issue. https://github.com/mermaid-js any ideas?

If you run npm install @mermaid-js/mermaid-cli (without sudo) are there any errors shown?

[!Note]

Running npm install @mermaid-js/mermaid-cli without the -g flag will install it only in the current folder.

Puppeteer v19.0.0 now downloads Chromium into the ~/.cache/puppeteer folder by default. It's possible that this folder cannot be written/loaded from (e.g. if you used sudo, and that folder is now locked to the admin user only).

Deleting the ~/.cache/puppeteer folder and rerunning npm install @mermaid-js/mermaid-cli might help!

You can also try reading https://pptr.dev/troubleshooting#could-not-find-expected-browser-locally to download puppeteer into a different folder using PUPPETEER_CACHE_DIR=~/my-folder-to-download-puppeteer-tocd

hamad12a commented 4 months ago

I need to convert a markdown mermaid file contains latex expressions, so only the recent version supports latex. I keep receiving Error: Could not find Chromium (rev. 1108766).

terra-nova commented 4 months ago

I need to convert a markdown mermaid file contains latex expressions, so only the recent version supports latex. I keep receiving Error: Could not find Chromium (rev. 1108766).

The cause of the error seems to be that that specific revision is no longer available at Google (HTTP status code 404):

npm error ERROR: Failed to set up Chromium r1108766! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.
npm error Error: Download failed: server returned code 404. URL: https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/1108766/chrome-linux.zip
MindaugasLaganeckas commented 4 months ago

If you hit this link from your browser https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/1108766/chrome-linux.zip then you see that the file is there. Just tried it seconds ago.

terra-nova commented 4 months ago

If you hit this link from your browser https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/1108766/chrome-linux.zip then you see that the file is there. Just tried it seconds ago.

Yes, you are right. I fell victim to an issue in Pupeteer when running behind a HTTP proxy (https://github.com/puppeteer/puppeteer/issues/10575).

aloisklink commented 4 months ago

One thing that may also help is running npm -g rebuild puppeteer if you've installed @mermaid-js/mermaid-cli with the -g flag, or npm rebuild puppeteer if you've installed it without the -g flag.

That should tell puppeteer to redownload the chrome browser!