components icon indicating copy to clipboard operation
components copied to clipboard

Error in theming.scss when executing ng serve

Open arianlopezc opened this issue 8 years ago • 4 comments

What is the expected behavior?

To run with no problems when ng serve.

What is the current behavior?

Currently, I just copied the code from the Material site and followed the steps but an error is popping out when I try to run ng serve.

My theme.scss file looks like this:

@import '~@angular/material/_theming.scss';

@include mat-core();

$candy-app-primary: mat-palette($mat-indigo); $candy-app-accent: mat-palette($mat-blue, A200, A100, A400);

$candy-app-warn: mat-palette($mat-red);

$candy-app-theme: mat-light-theme($candy-app-primary, $candy-app-accent, $candy-app-warn);

@include angular-material-theme($candy-app-theme);

The error is this one

ERROR in ./src/styles.css (./node_modules/raw-loader!./node_modules/postcss-loader/lib??embedded!./src/styles.css) Module build failed: Syntax Error

(118:13) Missed semicolon

116 | // We use display: flex on this element exclusively for centering connected overlays. 117 | // When not centering, a top/left/bottom/right will be set which overrides the normal

118 | // flex layout. | ^ 119 | display: flex; 120 | ℹ 「wdm」: Failed to compile.

Any idea guys?

arianlopezc avatar Jul 16 '18 03:07 arianlopezc

@arianlopezc please double check whether styles and theming files have the same extension either .scss or .css

vladimir-barsuchenko avatar Jul 16 '18 09:07 vladimir-barsuchenko

@levgaas I check on that but then another error happens

ERROR in ./src/styles.scss (./node_modules/raw-loader!./node_modules/postcss-loader/lib??embedded!./node_modules/sass-loader/lib/loader.js??ref--14-3!./src/styles.scss) Module build failed: Error: Cannot find module 'node-sass' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:594:15) at Function.Module._load (internal/modules/cjs/loader.js:520:25) at Module.require (internal/modules/cjs/loader.js:650:17) at require (internal/modules/cjs/helpers.js:20:18) at Object.sassLoader (/Users/NodeJS/node_modules/sass-loader/lib/loader.js:24:22)

arianlopezc avatar Jul 16 '18 11:07 arianlopezc

@arianlopezc try to create empty cli project with --style=scss flag. It will install deps that are needed and configure project properly for further usage.

Or try to install them manually.

Additional thought would be is to stick with css for now. Import css theming file from material module as described in docs.

vladimir-barsuchenko avatar Jul 16 '18 11:07 vladimir-barsuchenko

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.