Puppeteer error: "failed to launch the browser process"

Puppeteer error: "failed to launch the browser process"

我正在尝试 运行 在我的新笔记本电脑上玩 Puppeteer。但是,我收到此错误:

node:8144) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process!
/mnt/c/Users/juliu/repos/kmj-sniper/node_modules/puppeteer/.local-chromium/linux-901912/chrome-linux/chrome: error while loading shared libraries: libatk-1.0.so.0: cannot open shared object file: No such file or directory

我在这里错过了什么?

该错误消息可能表明您的操作系统缺少 ATK 库 (libatk),或者此共享库安装在 Puppeteer 不知道的位置,因为它不可用来自环境变量 LD_LIBRARY_PATH 中指定的路径,或者名称与预期的不同。

如果缺少 ATK 库,您的笔记本电脑是什么平台 运行 可能会确定答案。例如,如果您是 运行 Ubuntu,您可以执行以下操作或类似操作:

$ sudo apt-get install libatk-bridge2.0-0

CentOS/RHL,也许:

$ sudo yum install atk.x86_64

但是,如果已安装所需的包,请检查 LD_LIBRARY_PATH 是否包含共享库的安装目录,以及文件名是否与 Puppeteer 返回的错误消息中显示的相匹配。

删除文件夹 node_modules(不要删除 package.jsonpackage-lock.json 文件),然后 运行 npm i
它基本上会重新安装所有依赖项。
如果这不起作用,请尝试 .