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

Mac M1本地无法启动Puppeteer问题求助

Puppeteer启动浏览器报错的解决办法

以下是针对brew安装Puppeteer后启动失败的几种实用解决方案:

  • 指定浏览器可执行路径
    brew安装的Puppeteer可能无法自动识别系统Chrome路径,手动指定即可:

    const browser = await puppeteer.launch({
      headless: true,
      executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
    });
    

    若使用Chrome Canary,路径替换为/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary

  • 匹配Puppeteer与浏览器版本
    版本不兼容是常见问题,要么查看当前Puppeteer对应的Chromium版本,确保系统Chrome版本接近;要么重新安装Puppeteer让它自动下载适配的Chromium:

    npm uninstall puppeteer
    npm install puppeteer --save
    

    用yarn的话替换成yarn remove puppeteer && yarn add puppeteer

  • 更新headless模式参数
    新版Chrome对headless模式做了调整,原headless: true属于旧模式,尝试切换到新版:

    const browser = await puppeteer.launch({
      headless: "new"
    });
    
  • 修复权限问题
    确保浏览器执行文件有足够权限,执行以下命令:

    chmod +x /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.16 10:45:43