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
- 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.
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
Angular "Module not found: Error: Can't resolve" in CIFix "Module not found: Error: Can't resolve 'X'" in Angular CI builds - a webpack import path points at a fil…
Angular "anyComponentStyle exceeded maximum budget" in CIFix Angular "Error: X exceeded maximum budget" for a component stylesheet in CI - a single component CSS/SCSS…
Angular optimization / production build failures in CIFix Angular production build failures that only appear with optimization enabled in CI - AOT and the optimize…