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

Puppeteer启动失败求助:已装依赖仍无法找到Chrome浏览器

解决Puppeteer缺失Chromium导致的启动错误

已使用npm i安装所有依赖,但运行whatsapp-chatgpt时未显示预期的二维码,反而出现如下报错:

C:\Users\Maaz\Desktop\Development\whatsapp-chatgpt\node_modules\whatsapp-web.js\node_modules\puppeteer\lib\cjs\puppeteer\node\Launcher.js:105
throw new Error(missingText);
^

Error: Could not find expected browser (chrome) locally. Run <code>npm install</code> to download the correct Chromium revision (982053).
at ChromeLauncher.launch (C:\Users\Maaz\Desktop\Development\whatsapp-chatgpt\node_modules\whatsapp-web.js\node_modules\puppeteer\src\node\Launcher.ts:146:30)
at PuppeteerNode.launch (C:\Users\Maaz\Desktop\Development\whatsapp-chatgpt\node_modules\whatsapp-web.js\node_modules\puppeteer\src\node\Puppeteer.ts:155:27)
at Client.initialize (C:\Users\Maaz\Desktop\Development\whatsapp-chatgpt\node_modules\whatsapp-web.js\src\Client.js:100:39)

可行解决方法

  • 手动指定本地Chrome路径
    若电脑已安装Chrome浏览器,可在初始化Client时配置puppeteer的executablePath参数,指向Chrome的实际安装路径。示例代码:

    const { Client } = require('whatsapp-web.js');
    
    const client = new Client({
      puppeteer: {
        executablePath: 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe' // Windows路径,需根据实际安装位置调整
      }
    });
    
  • 重新安装Puppeteer并强制下载Chromium
    网络问题可能导致npm install时Chromium未下载完成,执行以下命令重新安装:

    npm uninstall puppeteer
    npm install puppeteer --force
    

    若报错来自whatsapp-web.js嵌套的puppeteer,可进入对应目录执行安装:

    cd node_modules/whatsapp-web.js/node_modules/puppeteer
    npm install
    
  • 跳过自动下载并使用本地Chrome
    设置环境变量PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true,阻止Puppeteer自动下载Chromium,再配合第一种方法指定本地Chrome路径即可。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.30 07:33:16