复制步骤
你好, 我正在尝试使用puppeteer导航到页面并生成所述页面的pdf渲染。在Linux的docker内部,它工作得很好,但是在Windows上与木偶戏捆绑在一起的铬我遇到了问题。
向我们介绍您的环境:
Puppeteer version: 3.3.0
Platform / OS version: Windows 10 pro / version : 1903 / OS Version : 18362.836
Node.js version: v12.16.3
哪些步骤可以重现该问题?
只需启动浏览器就足够了。
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({ignoreDefaultArgs: ['--disable-extensions']});
const page = await browser.newPage();
await page.goto('https://example.com');
console.log(await page.content());
await browser.close();
})();
预期结果是什么?
导航到https://example.com并记录页面内容
会发生什么?
(node:21156) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process!
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/master/docs/troubleshooting.md
at onClose (******\reproduce puppeteer\node_modules\puppeteer\lib\launcher\BrowserRunner.js:159:20)
at ChildProcess.<anonymous> (********\reproduce puppeteer\node_modules\puppeteer\lib\launcher\BrowserRunner.js:150:76)
at ChildProcess.emit (events.js:322:22)
at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
(node:21156) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:21156) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
预先感谢您的帮助