Skip to content
Latchkey

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.

node
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

  1. Run the official updater and commit the lockfile change.
Terminal
npx update-browserslist-db@latest

Fix the browserslist query

  1. Correct the query syntax in your config.
.browserslistrc
# .browserslistrc
last 2 versions
> 0.5%
not dead

How to prevent it

  • Schedule periodic update-browserslist-db runs so the data never goes stale.
  • Validate browserslist queries against the documented syntax.

Frequently asked questions

What causes "Browserslist error"?
The committed lockfile pins an old caniuse-lite, so autoprefixer warns the data is stale.
How do I fix Browserslist error?
Update the caniuse-lite database

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card