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

Puppeteer无法找到Chrome 127.0.6533.72的故障排查求助

Puppeteer Chrome 缺失报错解决方案

问题背景

运行Puppeteer时触发报错:

Error: Could not find Chrome (ver. 127.0.6533.72). This can occur if either
you did not perform an installation before running the script (e.g. `npx puppeteer browsers install chrome`) or
your cache path is incorrectly configured (which is: C:\Users\Kamaldeep\.cache\puppeteer).
For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides/configuration.

初始安装时未设置$env:PUPPETEER_SKIP_DOWNLOAD="true",直接执行npm i puppeteer会出现:

[cause]: Error: The browser folder (C:\Users\\.cache\puppeteer\chrome\win64-127.0.6533.72) exists but the executable (C:\Users\\.cache\puppeteer\chrome\win64-127.0.6533.72\chrome-win64\chrome.exe) is missingnpm ERR!       at installUrl (file:///C:/Users//Desktop/current/biddingTool/node_modules/@puppeteer/browsers/lib/esm/install.js:114:23)

已尝试操作无效:

  • 设置$env:PUPPETEER_SKIP_DOWNLOAD="true"后执行npm i puppeteer
  • 卸载并重装node_modules
  • 更新系统Chrome浏览器

可行解决方案

1. 清理缓存后重装指定版本Chrome

  • 手动删除缓存目录:C:\Users\Kamaldeep\.cache\puppeteer
  • 终端执行命令安装对应版本Chrome:
    npx puppeteer browsers install chrome@127.0.6533.72
    
  • 重新运行Puppeteer脚本

2. 直接指定系统Chrome路径

如果系统已安装Chrome,可在代码中跳过Puppeteer内置浏览器,直接调用本地Chrome:

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch({
    executablePath: 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe' // 按实际安装路径调整
  });
  // 业务代码逻辑
  await browser.close();
})();

3. 自定义Puppeteer缓存路径

避免默认缓存目录权限问题,修改配置指定新路径:

  • 在项目根目录创建.puppeteerrc.cjs文件:
    const { join } = require('path');
    
    /** @type {import("puppeteer").Configuration} */
    module.exports = {
      cacheDirectory: join(__dirname, '.cache', 'puppeteer'),
    };
    
  • 删除原缓存目录,重新执行npm i puppeteer

4. 检查缓存目录权限

若缓存目录权限不足导致下载中断:

  • 右键C:\Users\Kamaldeep\.cache文件夹 → 属性 → 安全
  • 确保当前用户拥有「完全控制」权限
  • 重新执行npx puppeteer browsers install chrome

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.20 06:35:59