Puppeteer UnhandledPromiseRejectionWarning



从台式机切换到笔记本电脑后,每次我试图运行木偶程序时都会出现以下错误:

(node:69) UnhandledPromiseRejectionWarning: TimeoutError: Timed out after 30000 ms while trying to connect to the browser! Only Chrome at revision r901912 is guaranteed to work.
at Timeout.onTimeout (/mnt/c/Users/trgre/OneDrive/Desktop/puppeteer-Core/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:208:20)
at listOnTimeout (internal/timers.js:554:17)
at processTimers (internal/timers.js:497:7)
(node:69) 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:69) [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.

最有可能的原因是Puppeteer驱动程序不匹配您的Chromeium版本。

From the docs:

注意:当您安装Puppeteer时,它会下载最新版本的Chromium (~170MB Mac, ~282MB Linux, ~280MB Win),保证使用API。要跳过下载,下载到另一个路径,或下载不同的浏览器,请参阅环境变量。

你会发现一个环境变量:PUPPETEER_CHROMIUM_REVISION

或者你可以重新安装Puppeteer并允许它安装正确版本的Chromium。

相关内容

  • 没有找到相关文章

最新更新