Skip to content

nvh95/netlify-plugin-playwright-cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– Netlify Plugin Playwright Cache

npm version PRs Welcome

Persist the Playwright executables between Netlify builds.

Why netlify-plugin-playwright-cache

When you install playwright-chromium, it downloads Chromium executables to a cache folder (not node_modules). Netlify does not cache this folder between builds, but caches node_modules. This leads to unsuccessful builds with the following error like this:

11:33:48 PM: [: Executable doesn't exist at /opt/buildhome/.cache/ms-playwright/chromium-1019/chrome-linux/chrome
╔═════════════════════════════════════════════════════════════════════════╗
11:33:48 PM: β•‘ Looks like Playwright Test or Playwright was just installed or updated. β•‘
11:33:48 PM: β•‘ Please run the following command to download new browsers:              β•‘
11:33:48 PM: β•‘                                                                         β•‘
11:33:48 PM: β•‘     npx playwright install                                              β•‘
11:33:48 PM: β•‘                                                                         β•‘
11:33:48 PM: β•‘ <3 Playwright Team                                                      β•‘
11:33:48 PM: β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

This plugins fixes the above issue by caching the Playwright executables (Chromium, ffmpeg...) between builds.

Installation

You can install netlify-plugin-playwright-cache by one of the following ways:

  1. Install directly from Netlify Dashboard:

  1. Install as a dependency of your project:
npm install --save-dev netlify-plugin-playwright-cache
# Or
yarn add -D netlify-plugin-playwright-cache
# Or
pnpm add -D netlify-plugin-playwright-cache

Then update netlify.toml to include the plugin:

[[plugins]]
  package = "netlify-plugin-playwright-cache"

Usage

Remember to Clear cache and retry deploy after adding the plugin.