升级puppeteer后 install报错,your cache path is incorrectly configured

178 阅读1分钟

执行

rm -rf node_modules package-lock.json
npm cache clean --force
npm install

加入 .puppeteerrc.cjs 文件 解决 Error: Could not find Chromium (rev. 1108766). This can occur if either your cache path is incorrectly configured


const { join } = require('path');

/**
 * @type {import("puppeteer").Configuration}
 */
module.exports = {
  // puppeteer 默认缓存路径在 CI 环境不会被打包进 docker 中,修改缓存目录到项目目录下
  cacheDirectory: join(__dirname, '.cache', 'puppeteer')
};