Skip to content
Latchkey

Sass "Can't find stylesheet to import" - Fix @use/@import in CI

Sass could not resolve a @use/@import/@forward target. The path is wrong, the case differs from the file, or the directory it lives in is not on Sass's load path.

What this error means

The compile fails with Error: Can't find stylesheet to import. pointing at the @use/@import line. It is deterministic and names the importing file and column.

sass output
Error: Can't find stylesheet to import.
  ╷
2 │ @use 'variables';
  │ ^^^^^^^^^^^^^^^^^
  ╵
  src/styles/main.scss 2:1  root stylesheet

Common causes

Wrong path or case mismatch

The partial does not exist at that path, or its casing differs (Variables vs variables). Case-sensitive Linux CI fails where macOS resolved it.

Directory not on the load path

A @use 'variables' that relies on a configured loadPaths/includePaths (e.g. a shared styles/ root) fails when the build does not pass that load path.

How to fix it

Correct the path and case

Sass partials are named with a leading underscore but imported without it - confirm the file exists with matching case.

Terminal
ls -la src/styles/_variables.scss   # imported as @use 'variables'
# fix the @use path or rename to match the case

Configure the load path

Tell your bundler's Sass integration where to find shared partials.

vite.config.ts
// vite.config.ts
export default defineConfig({
  css: { preprocessorOptions: { scss: { loadPaths: ['src/styles'] } } },
})

How to prevent it

  • Match @use/@import paths and casing to the real partial files.
  • Configure loadPaths/includePaths for shared style roots.
  • Compile styles in CI so resolution gaps fail before deploy.

Frequently asked questions

What causes ""Can't find stylesheet to import""?
The partial does not exist at that path, or its casing differs (Variables vs variables). Case-sensitive Linux CI fails where macOS resolved it.
How do I fix "Can't find stylesheet to import"?
Sass partials are named with a leading underscore but imported without it - confirm the file exists with matching case.

Related guides

References

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