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

slidev export failed in container #3

Open
kkongling opened this issue May 14, 2021 · 5 comments
Open

slidev export failed in container #3

kkongling opened this issue May 14, 2021 · 5 comments
Labels
bug Something isn't working

Comments

@kkongling
Copy link

command:

~/slides # cd /root/
~ # npm i playwright-chromium (work directory should be `/root/`)
~ # cd /root/slides
~/slides # ../node_modules/.bin/slidev export

Got err log:

  Slidev  v0.9.6

  theme   @slidev/theme-default
  entry   /root/slides/slides.md


(node:288) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at /root/node_modules/playwright-chromium/package.json.
Update this package.json to use a subpath pattern like "./*".
(Use `node --trace-deprecation ...` to show where the warning was created)
browserType.launch: Failed to launch: Error: spawn /root/.cache/ms-playwright/chromium-878941/chrome-linux/chrome ENOENT
=========================== logs ===========================
<launching> /root/.cache/ms-playwright/chromium-878941/chrome-linux/chrome --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=TranslateUI,BlinkGenPropertyTrees,ImprovedCookieControls,SameSiteByDefaultCookies,LazyFrameLoading --allow-pre-commit-input --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --disable-sync --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --no-service-autorun --user-data-dir=/tmp/playwright_chromiumdev_profile-aEEMoK --remote-debugging-pipe --headless --hide-scrollbars --mute-audio --blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4 --no-sandbox --no-startup-window
============================================================
Note: use DEBUG=pw:api environment variable to capture Playwright logs.
Error
    at Object.captureStackTrace (/root/node_modules/playwright-chromium/lib/utils/stackTrace.js:50:19)
    at Connection.sendMessageToServer (/root/node_modules/playwright-chromium/lib/client/connection.js:65:48)
    at Proxy.<anonymous> (/root/node_modules/playwright-chromium/lib/client/channelOwner.js:64:61)
    at /root/node_modules/playwright-chromium/lib/client/browserType.js:60:67
    at BrowserType._wrapApiCall (/root/node_modules/playwright-chromium/lib/client/channelOwner.js:77:34)
    at BrowserType.launch (/root/node_modules/playwright-chromium/lib/client/browserType.js:51:21)
    at exportSlides (/root/node_modules/@slidev/cli/dist/export-WGBEP3OU.js:62:34)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Object.handler (/root/node_modules/@slidev/cli/dist/cli.js:212:12)
@signed-log signed-log added the bug Something isn't working label May 14, 2021
@signed-log signed-log self-assigned this May 14, 2021
@signed-log
Copy link
Contributor

signed-log commented May 14, 2021

Hello,

This error complains about Chromium not being able to launch, this is a known bug on Node alpine images see here, this will not be fixed on the alpine linux-based image, but I'll introduce a new tag with debian-based images to fix this bug

@kkongling
Copy link
Author

I am building from ubuntu:

docker pull ubuntu:18.04
docker run -it -v /path/to/slidev:/root/slidev -p 3030:3030 ubuntu:18.04 /bin/bash

In container:

apt update
apt install -y curl
curl -fsSL https://deb.nodesource.com/setup_15.x | bash -
apt install -y nodejs
apt install -y chromium-browser

npm install @slidev/cli @slidev/theme-default
npm install playwright-chromium playwright
npx slidev export

Got err log:

  Slidev  v0.9.8

  theme   @slidev/theme-default
  entry   /root/slidev/demo/slides.md

browserType.launch: Failed to launch chromium because executable doesn't exist at /root/.cache/ms-playwright/chromium-878941/chrome-linux/chrome
Try re-installing playwright with "npm install playwright"
Error
    at Object.captureStackTrace (/root/slidev/demo/node_modules/playwright-chromium/lib/utils/stackTrace.js:50:19)
    at Connection.sendMessageToServer (/root/slidev/demo/node_modules/playwright-chromium/lib/client/connection.js:65:48)
    at Proxy.<anonymous> (/root/slidev/demo/node_modules/playwright-chromium/lib/client/channelOwner.js:64:61)
    at /root/slidev/demo/node_modules/playwright-chromium/lib/client/browserType.js:60:67
    at BrowserType._wrapApiCall (/root/slidev/demo/node_modules/playwright-chromium/lib/client/channelOwner.js:77:34)
    at BrowserType.launch (/root/slidev/demo/node_modules/playwright-chromium/lib/client/browserType.js:51:21)
    at exportSlides (/root/slidev/demo/node_modules/@slidev/cli/dist/export-WGBEP3OU.js:62:34)
    at processTicksAndRejections (node:internal/process/task_queues:94:5)
    at async Object.handler (/root/slidev/demo/node_modules/@slidev/cli/dist/cli.js:212:12)

I want to run slidev in container, and export pdf file.
Any suggestion?

@signed-log signed-log pinned this issue May 20, 2021
@signed-log
Copy link
Contributor

@kkongling Sorry for the wait, issue is on the way of being fixed

@fabianhauser
Copy link

@Stig124 there seem to be a few commits on the dev branch, are you still working on this or is the issue waiting on contributions?

@WinterYukky
Copy link

This Dockerfile can resolve this issue.

FROM mcr.microsoft.com/playwright:focal
RUN yarn global add @slidev/cli

how to use

  1. Build this Dockerfile and open.
  2. Execute next commands.
    1. yarn create slidev
    2. cd <project-directory>
    3. yarn add playwright-chromium
    4. yarn slidev export

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants