Skip to content
Latchkey

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

Dart Sass resolved an @use or @import and could not find the partial on disk. The path is wrong, the load path is not configured, or the filename case differs from the import on a case-sensitive runner.

What this error means

The compile aborts with Error: Can't find stylesheet to import. pointing at the @use/@import line. It fails the same way every run.

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

Common causes

Wrong relative path to the partial

The import string does not point at the partial. Sass looks for _variables.scss next to the importing file; a wrong directory or a missing partial breaks it.

Load path not configured

A bare import like @use 'variables' relies on a configured load path (--load-path / includePaths). Locally it may resolve via editor config that CI does not replicate.

Case mismatch on Linux

Importing @use 'Variables' while the file is _variables.scss passes on macOS and fails on the case-sensitive Linux runner.

How to fix it

Verify the path and partial name

  1. Confirm the partial exists with a leading underscore (_variables.scss).
  2. Make the import relative to the importing file, or add the directory.
  3. Match the case character for character.
main.scss
// src/styles/main.scss
@use './abstracts/variables';
// resolves to src/styles/abstracts/_variables.scss

Declare load paths in the build

  1. Pass the directory holding your partials as a load path so bare imports resolve.
Terminal
sass --load-path=src/styles src/styles/main.scss dist/main.css

How to prevent it

  • Prefer explicit relative paths (./ / ../) over bare imports.
  • Develop on a case-sensitive filesystem or add a CI case-check so casing bugs surface before the runner.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →