정보 공유: md2pdf ListrError 해결법

최대 1 분 소요

오류

다음과 같이 md2pdf를 이용하여 test라는 Markdown 파일을 PDF 파일로 변환하려고 할 때,

md2pdf test.md

다음과 같은 에러가 난다.

  ✖ generating PDF from test.md
    → TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
ListrError: Something went wrong
    at /md-to-pdf/node_modules/listr/index.js:102:18
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async main (/md-to-pdf/dist/cli.js:118:5) {
  errors: [
    Error: Failed to launch the browser process!
    [1013/000633.662852:ERROR:zygote_host_impl_linux.cc(90)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
    
    
    TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
    
        at onClose (/md-to-pdf/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:197:20)
        at Interface.<anonymous> (/md-to-pdf/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:187:68)
        at Interface.emit (events.js:412:35)
        at Interface.close (readline.js:451:8)
        at Socket.onend (readline.js:224:10)
        at Socket.emit (events.js:412:35)
        at endReadableNT (internal/streams/readable.js:1317:12)
        at processTicksAndRejections (internal/process/task_queues.js:82:21)
  ],
  context: [Object: null prototype] {}
}

해결

이러한 경우에는 다음의 명령어로 이를 해결할 수 있다.

md2pdf test.md --launch-options '{ "args": ["--no-sandbox"] }'

댓글남기기