Skip to content
Latchkey

PostCSS "postcss-import: Failed to find" in CI

The postcss-import plugin inlines @import rules by resolving each path. "Failed to find" means an imported stylesheet path does not exist relative to the resolver's search roots in CI.

What this error means

The CSS build fails with "Failed to find './components/buttons.css' in [ ... ]" listing the directories postcss-import searched.

postcss
Error: Failed to find './components/buttons.css'
  in [
    /home/runner/work/app/app/src/styles
  ]

Common causes

The import path is wrong or the file is uncommitted

The @import points at a file that does not exist in the checkout, often a path that worked locally but is gitignored or misspelled.

Case sensitivity on the runner

A path like Buttons.css imported as buttons.css resolves on a case-insensitive local disk but fails on a Linux runner.

How to fix it

Correct the import path

  1. Read the searched directories in the error.
  2. Fix the @import to a path that exists relative to those roots, matching case exactly.
  3. Re-run the build.
styles/main.css
/* match the real file path and case */
@import './components/buttons.css';

Add a resolve search path

If imports come from a shared directory, configure postcss-import with the search path so it resolves consistently.

postcss.config.js
// postcss.config.js
export default { plugins: { 'postcss-import': { path: ['src/styles'] } } };

How to prevent it

  • Commit every stylesheet referenced by @import.
  • Match import path casing to the real filenames for case-sensitive runners.
  • Configure postcss-import search paths for shared style directories.

Frequently asked questions

What causes ""Failed to find" (postcss-import)"?
The @import points at a file that does not exist in the checkout, often a path that worked locally but is gitignored or misspelled.
How do I fix "Failed to find" (postcss-import)?
Correct the import path

Related guides

References

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