You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Debian系统下Puppeteer v20所需Chrome for Testing安装咨询

在Debian上安装适配Puppeteer v20+的Chrome二进制文件

方法1:利用Puppeteer自动下载Chrome for Testing

Puppeteer v20+内置了针对arm64架构的Chrome for Testing下载逻辑,无需手动找包:

  • 确保安装最新版Puppeteer:npm install puppeteer@latest
  • 若之前有缓存干扰,先清理缓存再重装:
    rm -rf node_modules/puppeteer/.local-chromium
    npm install puppeteer@latest
    
    安装过程中会自动检测arm64架构,从官方仓库拉取对应版本的Chrome for Testing二进制文件。

方法2:手动下载并配置Chrome for Testing

如果自动下载失败,可手动操作:

  1. 查看当前Puppeteer要求的Chrome版本:
    npx puppeteer browsers print-versions chrome
    
  2. 下载对应arm64版本的Chrome for Testing压缩包,解压到指定目录(比如/opt/chrome-for-testing/):
    # 替换<版本号>为步骤1获取的版本
    wget https://storage.googleapis.com/chrome-for-testing-public/<版本号>/linux-arm64/chrome-linux-arm64.zip
    unzip chrome-linux-arm64.zip -d /opt/chrome-for-testing/
    
  3. 让Puppeteer指定该二进制文件:
    • 代码内指定:
      const puppeteer = require('puppeteer');
      (async () => {
        const browser = await puppeteer.launch({
          executablePath: '/opt/chrome-for-testing/chrome-linux-arm64/chrome'
        });
        // 业务逻辑
        await browser.close();
      })();
      
    • 或通过环境变量全局指定:
      export PUPPETEER_EXECUTABLE_PATH=/opt/chrome-for-testing/chrome-linux-arm64/chrome
      

方法3:通过第三方源安装Google Chrome稳定版

Debian官方源无Chrome,但可通过Google第三方源安装稳定版,Puppeteer v20+通常兼容:

  1. 添加Google签名密钥:
    wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
    
  2. 添加Chrome源:
    echo "deb [arch=arm64] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google-chrome.list
    
  3. 更新源并安装:
    sudo apt update
    sudo apt install google-chrome-stable
    
  4. 配置Puppeteer使用该二进制,路径为/usr/bin/google-chrome-stable,同样可通过代码或环境变量指定。

注意:此方法安装的是稳定版Chrome,非官方的Chrome for Testing,存在版本匹配风险,优先推荐前两种方法。

内容的提问来源于stack exchange,提问作者drmrbrewer

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.22 18:22:13