【发布时间】:2019-05-18 17:43:54
【问题描述】:
我在 puppeteer-cluster 文档中使用了这个示例
我在节点 v10.15.3 上运行它,我尝试将 headless 属性和 slowMo 传递给 puppeteer 选项。
我希望代码注销并创建页面的屏幕截图,但是,会发生几个 chrome 实例启动,它们没有加载任何页面,然后控制台挂起并出现以下错误:
(node:30826) UnhandledPromiseRejectionWarning: Error: Unable to get browser page
at Worker.<anonymous> (/Users/Starlord/Code/oppose/node_modules/puppeteer-cluster/dist/Worker.js:43:31)
at Generator.next (<anonymous>)
at fulfilled (/Users/Starlord/Code/oppose/node_modules/puppeteer-cluster/dist/Worker.js:4:58)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:30826) 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(). (rejection id: 21)
(node:30826) [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.
(node:30826) UnhandledPromiseRejectionWarning: Error: Unable to get browser page
at Worker.<anonymous> (/Users/Starlord/Code/oppose/node_modules/puppeteer-cluster/dist/Worker.js:43:31)
at Generator.next (<anonymous>)
at fulfilled (/Users/Starlord/Code/oppose/node_modules/puppeteer-cluster/dist/Worker.js:4:58)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:30826) 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(). (rejection id: 22)
^Cinternal/process/per_thread.js:198
throw errnoException(err, 'kill');
^
Error: kill ESRCH
at process.kill (internal/process/per_thread.js:198:13)
at process.killChrome (/Users/Starlord/Code/oppose/node_modules/puppeteer/lib/Launcher.js:110:17)
at process.emit (events.js:189:13)
【问题讨论】:
-
这里的库的作者。当新页面的打开多次失败时会发生这种情况。大多数时候,还有一些其他问题,例如内存/磁盘/CPU 限制,可能会导致浏览器崩溃。可以加debugging logs吗?然后我可以准确地告诉你为什么会发生错误。
-
感谢您这么快回来! pastebin.com/9d3JB3aA
标签: javascript node.js puppeteer puppeteer-cluster