Skip to content
Latchkey

Angular SCSS "Can't find stylesheet to import" in CI

The Sass compiler could not resolve a @use or @import. On the Linux runner the path is case-sensitive, or the includePaths are not configured, so a stylesheet that imports fine locally fails in CI.

What this error means

ng build fails with "Error: Can't find stylesheet to import." and a caret under the @use or @import line in a component or global SCSS file.

ng build
Error: Can't find stylesheet to import.
  |
3 | @use 'Styles/variables' as vars;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Common causes

Case-sensitive import path on Linux

The import used Styles/variables but the folder is styles; only the Linux runner enforces the case difference.

Missing includePaths for a shared styles directory

Importing from a shared directory without stylePreprocessorOptions includePaths leaves Sass unable to resolve the partial.

How to fix it

Match the import path case and location

  1. Correct the @use/@import to the exact directory and file case.
  2. For shared partials, add includePaths under stylePreprocessorOptions in angular.json.
  3. Rebuild to confirm Sass resolves the import.
angular.json
"stylePreprocessorOptions": {
  "includePaths": ["src/styles"]
}

Use exact relative paths

Prefer explicit relative @use paths that match the real file name and case exactly.

component.scss
@use 'styles/variables' as vars;

How to prevent it

  • Keep SCSS import paths case-exact for Linux runners.
  • Configure stylePreprocessorOptions includePaths for shared partials.
  • Prefer @use with explicit relative paths.

Related guides

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