首页 > 解决方案 > 启用远程调试时禁用导航超时

问题描述

我看到了关于 --remote-debugging 的其他部分,但是在运行我的谷歌云功能时,我没有启用它。我仍然收到回调:

未处理的错误错误:无法启动浏览器进程![0122/235916.996111:ERROR:headless_shell.cc(204)] 启用远程调试时禁用导航超时。

我对 puppeteer 的初始化是:

const browser   = await puppeteer.launch(PUPPETEER_OPTIONS);
const page      = await browser.newPage();

我的 PUPPETEER_OPTIONS 等于:

const PUPPETEER_OPTIONS = {
    headless: true,
    args: [
        '--disable-gpu',
        '--disable-dev-shm-usage',
        '--disable-setuid-sandbox',
        '--timeout=30000',
        '--no-first-run',
        '--no-sandbox',
        '--no-zygote',
        '--single-process',
        "--proxy-server='direct://'",
        '--proxy-bypass-list=*',
        '--deterministic-fetch',
    ],
};

我正在运行 node10 并使用 puppeteer v5.5.0,并在谷歌云功能中运行 puppeteer。我试过取出'-timeout = 30000',只留下'--no-sandbox',有无无头:真的,错误仍然存​​在。

标签: javascriptgoogle-cloud-firestoregoogle-cloud-functionspuppeteerchromium

解决方案


我将以下 puppeteer 配置与 NodeJS 10 框架一起使用,它对我有用

const PUPPETEER_OPTIONS = {
  headless: true,
  args: [
    '--disable-gpu',
    '--disable-dev-shm-usage',
    '--disable-setuid-sandbox',
    '--no-sandbox',
    '--window-size=1920,1080'
  ]
};

推荐阅读