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.
Error: Can't find stylesheet to import.
╷
3 │ @use 'variables';
│ ^^^^^^^^^^^^^^^^^
╵
src/styles/main.scss 3:1 root stylesheetCommon 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
- Confirm the partial exists with a leading underscore (
_variables.scss). - Make the import relative to the importing file, or add the directory.
- Match the case character for character.
// src/styles/main.scss
@use './abstracts/variables';
// resolves to src/styles/abstracts/_variables.scssDeclare load paths in the build
- Pass the directory holding your partials as a load path so bare imports resolve.
sass --load-path=src/styles src/styles/main.scss dist/main.cssHow 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.