【Could not find Chrome This can occur if either】

爬虫练习中遇到的问题

使用puppeteer执行是提示一下错误

Error: Could not find Chrome (ver. 125.0.6422.78). This can occur if either

  1. you did not perform an installation before running the script (e.g. npx puppeteer browsers install chrome) or
  2. your cache path is incorrectly configured (which is: /**//.cache/puppeteer).

puppeteer这个库 需要chrome浏览器

要么安装,要么你电脑中浏览器的绝对路径放上

我电脑中的路径是这个
const CHROME_EXECUTALBE_PATH = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"

js 复制代码
  const browser = await puppeteer.launch({
        headless: false,
        defaultViewport: {
            width: 0,
            height: 0
        },
        executablePath: CHROME_EXECUTALBE_PATH // 这个路径写上就可以执行了
    });
相关推荐
杜蒙1 分钟前
React Hooks 详解
前端·javascript
南囝coding1 分钟前
Claude Code 从入门到精通:最全配置指南和工具推荐
前端·后端
索马里亚纳海参炒贩2 分钟前
useCallback useMemo memo 三个区别和作用
前端·react native
非ban必选13 分钟前
netty-scoket.io路径配置
java·服务器·前端
じòぴé南冸じょうげん1 小时前
小程序的project.private.config.json是无依赖文件,那可以删除吗?
前端·小程序·json
会豪1 小时前
Electron主进程渲染进程如何优雅的进行通信
前端
jianghaha20111 小时前
前端 Word 模板参入特定数据 并且下载
前端·word
跟橙姐学代码1 小时前
轻松搞定 Python 模块与包导入:新手也能秒懂的入门指南
前端·python·ipython
aiwery1 小时前
大模型场景下的推送技术选型:轮询 vs WebSocket vs SSE
前端·agent
会豪1 小时前
前端插件-不固定高度的DIV如何增加transition
前端