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.
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
- Correct the @use/@import to the exact directory and file case.
- For shared partials, add includePaths under stylePreprocessorOptions in angular.json.
- Rebuild to confirm Sass resolves the import.
"stylePreprocessorOptions": {
"includePaths": ["src/styles"]
}Use exact relative paths
Prefer explicit relative @use paths that match the real file name and case exactly.
@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.