Sass "Can't find stylesheet to import" - Fix @use/@import in CI
Sass could not resolve a @use/@import/@forward target. The path is wrong, the case differs from the file, or the directory it lives in is not on Sass's load path.
What this error means
The compile fails with Error: Can't find stylesheet to import. pointing at the @use/@import line. It is deterministic and names the importing file and column.
Error: Can't find stylesheet to import.
╷
2 │ @use 'variables';
│ ^^^^^^^^^^^^^^^^^
╵
src/styles/main.scss 2:1 root stylesheetCommon causes
Wrong path or case mismatch
The partial does not exist at that path, or its casing differs (Variables vs variables). Case-sensitive Linux CI fails where macOS resolved it.
Directory not on the load path
A @use 'variables' that relies on a configured loadPaths/includePaths (e.g. a shared styles/ root) fails when the build does not pass that load path.
How to fix it
Correct the path and case
Sass partials are named with a leading underscore but imported without it - confirm the file exists with matching case.
ls -la src/styles/_variables.scss # imported as @use 'variables'
# fix the @use path or rename to match the caseConfigure the load path
Tell your bundler's Sass integration where to find shared partials.
// vite.config.ts
export default defineConfig({
css: { preprocessorOptions: { scss: { loadPaths: ['src/styles'] } } },
})How to prevent it
- Match
@use/@importpaths and casing to the real partial files. - Configure
loadPaths/includePathsfor shared style roots. - Compile styles in CI so resolution gaps fail before deploy.