-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Centos环境下报错:浏览器API异常 #113
Comments
不好意思,我少删了一个},所以我上面放的那个异常并不是导致 “浏览器API异常” 的原因。 以下这个才是: [root@aliyun juejin-helper-back]# yarn checkin
yarn run v1.22.19
$ ts-node checkin.js
--------模拟访问---------
Error: Failed to launch the browser process!
/root/.cache/puppeteer/chrome/linux-1069273/chrome-linux/chrome: error while loading shared libraries: libatk-bridge-2.0.so.0: cannot open shared object file: No such file or directory
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
at onClose (/usr/juejin/juejin-helper-back/node_modules/puppeteer-core/src/node/BrowserRunner.ts:328:9)
at Interface.<anonymous> (/usr/juejin/juejin-helper-back/node_modules/puppeteer-core/src/node/BrowserRunner.ts:314:16)
at Interface.emit (node:events:406:35)
at Interface.emit (node:domain:475:12)
at Interface.close (node:readline:586:8)
at Socket.onend (node:readline:277:10)
at Socket.emit (node:events:406:35)
at Socket.emit (node:domain:475:12)
at endReadableNT (node:internal/streams/readable:1343:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. |
我通过newbing,安装了一些依赖在我的centos7上,但仍然无法正常运行,它总有一些奇奇怪怪的错误 我使用root用户执行时 yarn run v1.22.19
$ ts-node checkin.js
--------模拟访问---------
Error: Failed to launch the browser process!
[0323/221802.690218:ERROR:zygote_host_impl_linux.cc(100)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
at onClose (/usr/juejin/juejin-helper-back/node_modules/puppeteer-core/src/node/BrowserRunner.ts:328:9)
at Interface.<anonymous> (/usr/juejin/juejin-helper-back/node_modules/puppeteer-core/src/node/BrowserRunner.ts:314:16)
at Interface.emit (node:events:406:35)
at Interface.emit (node:domain:475:12)
at Interface.close (node:readline:586:8)
at Socket.onend (node:readline:277:10)
at Socket.emit (node:events:406:35)
at Socket.emit (node:domain:475:12)
at endReadableNT (node:internal/streams/readable:1343:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. 我使用jenkins用户执行时: yarn run v1.22.19
$ ts-node checkin.js
--------模拟访问---------
Error: Could not find Chromium (rev. 1069273). This can occur if either
1. you did not perform an installation before running the script (e.g. `npm install`) or
2. your cache path is incorrectly configured (which is: /var/lib/jenkins/.cache/puppeteer).
For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides/configuration.
at ChromeLauncher.resolveExecutablePath (/usr/juejin/juejin-helper-back/node_modules/puppeteer-core/src/node/ProductLauncher.ts:118:17)
at ChromeLauncher.executablePath (/usr/juejin/juejin-helper-back/node_modules/puppeteer-core/src/node/ChromeLauncher.ts:247:19)
at ChromeLauncher.launch (/usr/juejin/juejin-helper-back/node_modules/puppeteer-core/src/node/ChromeLauncher.ts:101:31)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. 貌似Chrome的这个驱动对Centos的支持并不好,我发现Github Actions上用的是Ubuntu |
Centos还没有进行尝试过, 但Ubuntu是没问题的 |
1 similar comment
Centos还没有进行尝试过, 但Ubuntu是没问题的 |
😢😢😢是这样的 |
same |
关闭沙盒就好了 |
@ianding 能详细说说吗? |
const browser = await puppeteer.launch({ 增加args参数,但是官方不推荐,可以使用推荐的另两种方法https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#chrome-headless-doesnt-launch-on-unix |
我当前的环境是Centos7,我参照项目文档的Juejin Workflows 掘金工作流 这一部分,配置了相关的参数。
当我在Linux上运行时,发生了一个错误:浏览器API异常。 但我在自己的windows上,以及GithubActions上运行,都没有出现这个问题。
于是我去拉取了项目的代码,找到了这行小字所在的位置。我把这段代码的try catch给注释掉了,然后再次让它运行,它抛出了这样的异常:
我windows上的node版本和Linux上一样,应该不是版本的问题。
我是一名Java开发者,对JS并不熟悉,希望作者能帮我看一看这个问题,非常感谢!
The text was updated successfully, but these errors were encountered: