Search code examples
cssnode.jssassnode-sass

Node-SASS Compiler fails - Invalid CSS


I am trying to compile a .sass file using the node-sass module from a nodejs application. However the compile fails with an Invalid CSS Error.

Here is my SCSS:

body {
    background: rgb(255, 0, 0);
}

Here is the full error message:

Original Error: { [Error: Invalid CSS after "body {": expected "}", was "{"]
status: 1,
file: 'C:/localhost/NodeJS-Server/private/sass/style.sass',
line: 2,
column: 7,
message: 'Invalid CSS after "body {": expected "}", was "{"',
formatted: 'Error: Invalid CSS after "body {": expected "}", was "{"\n on line 2 of private/sass/style.sass\n>> body { {\n   ------^\n' }

I have no idea where this second '{' comes from.


Solution

  • SCSS files use the .scss extension, not .sass. The two formats have a different syntax.

    Read about the differences here: https://responsivedesign.is/articles/difference-between-sass-and-scss