Emacs ob-mermaid 사용 시 puppeteer관련 symlink 관련 에러 발생

[Witness Jo]

2024/05/27

Arch Linux 상에서 작업 중

org모드에서 ob-mermaid를 사용하기 위해서 mermaid-cli 설치 완료.

이 후 테스트로 mmdc CLI를 테스트 하는데 아래의 메시지와 함께 output 파일이 안 생김

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/sacha/.cache/puppeteer).
For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides/configuration.900"

찾아보니 Emacs 생테계에서 조금 유명한 sacha chua님의 블로그에서 원인을 찾을 수 있었음 https://sachachua.com/blog/2023/10/getting-mermaid-js-running-on-my-system-needed-to-symlink-chromium-for-puppeteer/

$ sudo npm install -g puppeteer mermaid @mermaid-js/mermaid-cli --unsafe-perm
# Cache Chromium for my own user
$ node /usr/lib/node_modules/puppeteer/install.js --unsafe-perm
$ sudo npm install -g mermaid @mermaid-js/mermaid-cli
$ ln -s ~/.cache/puppeteer/chrome/linux-125.0.6422.78 ~/.cache/puppeteer/chrome/linux-1108766
$ ln -s ~/.cache/puppeteer/chrome/linux-125.0.6422.78/chrome-linux64/ ~/.cache/puppeteer/chrome/linux-125.0.6422.78/chrome-linux

위의 내용을 수행했더니

mermaid code snippet에 대한 이미지가 이상없이 생성되었음