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

Unterminated quoted string in error handling code of browser launch #568

Closed
SmartLayer opened this issue Jul 17, 2023 · 1 comment
Closed

Comments

@SmartLayer
Copy link

SmartLayer commented Jul 17, 2023

Describe the bug
A syntax error in the error handling code.

To Reproduce

  1. Install though npm. The computer is Linux and have no Chrome.
  2. Run this:
$ mmdc -i test.mmd
/usr/local/lib/node_modules/mermaid.cli/node_modules/puppeteer/lib/Launcher.js:348
      reject(new Error([
             ^

Error: Failed to launch chrome!
/usr/local/lib/node_modules/mermaid.cli/node_modules/puppeteer/.local-chromium/linux-686378/chrome-linux/chrome: 1: Syntax error: Unterminated quoted string


TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

    at onClose (/usr/local/lib/node_modules/mermaid.cli/node_modules/puppeteer/lib/Launcher.js:348:14)
    at Interface.<anonymous> (/usr/local/lib/node_modules/mermaid.cli/node_modules/puppeteer/lib/Launcher.js:337:50)
    at Interface.emit (node:events:525:35)
    at Interface.close (node:internal/readline/interface:533:10)
    at Socket.onend (node:internal/readline/interface:259:10)
    at Socket.emit (node:events:525:35)
    at endReadableNT (node:internal/streams/readable:1359:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

Node.js v18.13.0

Expected behavior

  1. mmdc prints an error that it requires Google Chrome
  2. (it would be nice to) point out how to configure it to use Chromium instead, because the user may not be able to run Google Chrome at all. Such as my laptop is linux arm64, and there is no Chrome for it.

Desktop (please complete the following information):

  • OS: Ubuntu 23.04 ARM64 (not AMD64)
  • Browser: Chromium
  • Version: 114 (Chromium)

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
This issue is not asking to support Chromium (although would nice). It's asking to fix the error handling.

@SmartLayer SmartLayer changed the title Error handling code failed to handle error in the case of missing expected browser Chrome Unterminated quoted string in error handling code of browser launch Jul 17, 2023
@aloisklink
Copy link
Member

Hi @weiwu-zhang, it seems like you're using mermaid.cli (very outdated (5 years old)), instead of @mermaid-js/mermaid-cli.

You may want to npm uninstall -g mermaid.cli. If you have a modern version of Node.JS, you can also just use npx @mermaid-js/mermaid-cli and NPM should auto-install the updated package in a cache directory.

I believe puppeteer will automatically download an ARM64 version on MacOS, but I'm not sure if it will on Linux (see puppeteer/puppeteer#550). However, you can create a puppeteer-config.json file that has the contents like: {"executablePath": "/usr/bin/chromium-browser"}, you can then run mmdc --puppeteerConfigFile puppeteer-config.json -i test.mmd and it should work!

Let me know if you're still having this bug (or a different bug) with the latest version of @mermaid-js/mermaid-cli, and I'll re-open this issue.

@aloisklink aloisklink closed this as not planned Won't fix, can't repro, duplicate, stale Jul 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants