Autoprefixer Browserslist Error - Fix in CI
Autoprefixer reads target browsers from browserslist. A stale caniuse-lite or a query it cannot parse makes it warn loudly or error, which a strict CI escalates to a failure.
What this error means
The build prints Browserslist: caniuse-lite is outdated or Unknown browser query. Under warnings-as-errors it fails the job.
Browserslist: caniuse-lite is outdated. Please run:
npx update-browserslist-db@latest
Error: Unknown browser query `last 2 verions`. Maybe you meant `last 2 versions`?Common causes
Outdated caniuse-lite
The committed lockfile pins an old caniuse-lite, so autoprefixer warns the data is stale.
Malformed browserslist query
A typo in .browserslistrc or the browserslist field (e.g. last 2 verions) cannot be parsed.
How to fix it
Update the caniuse-lite database
- Run the official updater and commit the lockfile change.
npx update-browserslist-db@latestFix the browserslist query
- Correct the query syntax in your config.
# .browserslistrc
last 2 versions
> 0.5%
not deadHow to prevent it
- Schedule periodic
update-browserslist-dbruns so the data never goes stale. - Validate browserslist queries against the documented syntax.