爬蟲練習中遇到的問題
使用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: false,defaultViewport: {width: 0,height: 0},executablePath: CHROME_EXECUTALBE_PATH // 這個路徑寫上就可以執行了});