【问题标题】:Puppeteer with Headless_shell?带 Headless_shell 的木偶戏?
【发布时间】:2019-02-05 01:11:34
【问题描述】:

我正在尝试使用 headless_shell 来处理 puppeteer,以避免 Linux 中的库依赖。当我尝试const browser = await puppeteer.launch({executablePath: 'out/Release/headless_shell'}) 时,会创建浏览器。但是当我尝试时,const page = await browser.newPage(); 该过程就在那里停止,没有任何错误。 对于 headless_shell 的不同版本,我收到此错误。

 (node:17176) UnhandledPromiseRejectionWarning: Error: Failed to launch chrome!
    [0906/155318.398013:ERROR:icu_util.cc(172)] Invalid file descriptor to ICU data received.
    [0906/155318.398147:FATAL:content_main_delegate.cc(58)] Check failed: false. 
    #0 0x000002abf89c base::debug::StackTrace::StackTrace()
    #1 0x000002a45ca0 logging::LogMessage::~LogMessage()
    #2 0x0000029edc23 content::ContentMainDelegate::TerminateForFatalInitializationError()
    #3 0x0000029f5202 content::ContentMainRunnerImpl::Initialize()
    #4 0x000003d6b528 service_manager::Main()
    #5 0x0000029ee4a1 content::ContentMain()
    #6 0x000002ae077d headless::(anonymous namespace)::RunContentMain()
    #7 0x000002ae0808 headless::HeadlessBrowserMain()
    #8 0x000002a2e84a headless::HeadlessShellMain()
    #9 0x7f38923ac830 __libc_start_main
    #10 0x00000124f02a _start

【问题讨论】:

    标签: node.js puppeteer google-chrome-headless


    【解决方案1】:

    问题是目录/文件的权限。

    安装 puppeteer 时,权限是 nobody 的默认所有者:但并非所有文件都设置了组或其他位(即 600 或 700)。 Puppeteer 安装为npm install -g puppeteer,并以本地用户身份运行。修复方法是 chmod 文件以设置组和其他位以匹配“用户”。

    cd out/Release/headless_shell #or wherever the file is
    find . -type d | xargs -L1 -Ixx sudo chmod 755 xx
    find . -type f -perm /u+x | xargs -L1 -Ixx sudo chmod 755 xx
    find . -type f -not -perm /u+x | xargs -L1 -Ixx sudo chmod 644 xx
    

    PS:实际错误显示为Invalid file descriptor to ICU data received,问题https://github.com/GoogleChrome/puppeteer/issues/2519进行了深入讨论。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-12-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-14
      • 1970-01-01
      • 2012-06-11
      • 2019-07-29
      相关资源
      最近更新 更多