【问题标题】:Playwright - Can't launch Chromium when it's in node_modules (Azure Function - Linux and Windows)Playwright - 在 node_modules 中时无法启动 Chromium(Azure 函数 - Linux 和 Windows)
【发布时间】:2021-03-11 23:49:52
【问题描述】:

我制作了一个使用 Playwright 的 Azure 函数。它在本地工作,好吧,那部分不会改变)

然后我创建了 Azure DevOps 管道,因此它使用 Ubuntu 代理,使用 PLAYWRIGHT_BROWSERS_PATH=0 构建它,因此 Chromium 被下载到 node_modules(我在那里看到了它)。然后发布到 Linux Azure Function。

但是当函数在 Azure 中运行时,这一行:

  const crBrowser = await chromium.launch({
    executablePath:
      "./node_modules/playwright-chromium/.local-browsers/chromium-827102/chrome-linux/chrome",
  });

抛出此错误:

错误:产生 ./node_modules/playwright-chromium/.local-browsers/chromium-827102/chrome-linux/chrome EACCES ============================日志====================== ===== ./node_modules/playwright-chromium/.local-browsers/chromium-827102/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-用法 --disable-extensions --disable-features=TranslateUI,BlinkGenPropertyTrees,ImprovedCookieControls,SameSiteByDefaultCookies,LazyFrameLoading --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 --user-data-dir=/tmp/playwright_chromiumdev_profile-JZVt2S --remote-debugging-pipe --headless --hide-scrollbars --mute-audio --blink-settings=primaryHoverType= 2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4 --no-sandbox --no-startup-window ==================================================== ==========

我在 Windows 和 Linux 上试过这个——同样的,只是措辞不同。

【问题讨论】:

  • 你看过这个吗? anthonychu.ca/post/…
  • 这就是它的来源。
  • 我在通过 Azure DevOps 管道构建和部署时遇到了同样的问题。您是否以某种方式解决了这个问题?

标签: typescript azure azure-functions playwright


【解决方案1】:

Anthony Chu(cmets 中提到的文章的作者,也是让我首先尝试这个的人)回答说他无法让它与剧作家一起工作。它只适用于 puppeteer-sharp。

【讨论】:

    猜你喜欢
    • 2022-12-14
    • 1970-01-01
    • 1970-01-01
    • 2017-02-19
    • 1970-01-01
    • 2021-07-03
    • 1970-01-01
    • 2021-05-09
    • 1970-01-01
    相关资源
    最近更新 更多