Troubleshooting
SCSS Compilation Errors
Fix Dart Sass compilation failures in your stylesheets.
Symptom
A deployment fails with an SCSS-specific error. The error message references a .scss or .sass file and includes a line number, column number, and a code snippet from the Dart Sass compiler.
Example:
SCSS error in styles/main.scss at line 12, column 8
11 | .container {
> 12 | colr: red;
^
13 | }
Error: Expected expression.Likely Causes
- Syntax error in SCSS: Typo in a property name, missing semicolon, unclosed block, invalid nesting.
- Undefined variable or mixin: Referencing a
$variableor@mixinthat is not defined in the file or any imported partial. - Missing partial file: An
@useor@importreferences a partial file (e.g.,@use 'variables') that does not exist in the project. - SASS indented syntax errors:
.sassfiles use indentation-based syntax. Mixing SCSS brace syntax in a.sassfile causes parse failures. - Deprecated SCSS features: Dart Sass has deprecated some legacy features (e.g.,
@importin favor of@use,/for division in favor ofmath.div()). While these currently produce warnings, future Dart Sass versions may reject them.
Checks
- Open the file referenced in the error message and navigate to the indicated line.
- Check for obvious typos: misspelled property names, missing colons or semicolons, unclosed braces.
- If the error references an undefined variable (
$primary-color), search for its definition across your SCSS files. Variables must be@use'd or@import'd from the file that defines them. - If the error references a missing file, verify the partial exists in the file tree. SCSS partials are resolved by file name (with or without the leading
_and the.scssextension). - Check the file extension:
.scssfiles use brace syntax,.sassfiles use indentation syntax. Ensure you are using the correct syntax for the file type.
Fixes
Fix syntax errors
Correct the code at the indicated line. Common fixes:
- Add the missing semicolon at the end of a declaration.
- Close an unclosed brace
}. - Fix a misspelled property name (e.g.,
colrtocolor).
Define missing variables
Either define the variable in the same file or import the file that defines it:
// _variables.scss
$primary-color: #9ad8ff;
// main.scss
@use 'variables';
.button {
color: variables.$primary-color;
}Fix missing partials
- Verify the partial file exists in the file tree.
- Check the import path.
@use 'variables'resolves to_variables.scssorvariables.scssin the same directory. - If the partial is in a subdirectory, include the path:
@use 'abstracts/variables'. - Create the missing file if it was deleted or never added.
Convert deprecated syntax
Replace @import with @use:
// Deprecated:
@import 'variables';
.button { color: $primary-color; }
// Updated:
@use 'variables';
.button { color: variables.$primary-color; }Replace / division with math.div():
@use 'sass:math';
.container {
width: math.div(100%, 3);
}What to Capture for Escalation
- The full error message from the Problems panel (file, line, column, message).
- The content of the SCSS file at the indicated line (copy 5 lines above and below).
- A list of all SCSS files in the project and their import relationships.
- Whether the project uses
.scssor.sassfiles (or both). - Whether the error appeared after adding or renaming a file.