【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
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: /**//.cache/puppeteer).
puppeteer这个库 需要chrome浏览器
要么安装,要么你电脑中浏览器的绝对路径放上
我电脑中的路径是这个
const CHROME_EXECUTALBE_PATH = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
const browser = await puppeteer.launch(
{
headless: true,
executablePath: "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" // 这个路径写上就可以执行了
}
);