PaulDickson
PaulDickson

Reputation: 69

Angular project build with Cannot Get / error

I tried to run my Angular in IntelliJ and got this error. When I open the browser on localhost it shows Cannot GET /

The steps I took were:

ERROR in ./src/novus-rego-theme/theme.scss (./node_modules/css-loader/dist/cjs.js??ref--13-1!./node_modules/postcss-loader/src??embedded!./node_modules/
sass-loader/dist/cjs.js??ref--13-3!./src/novus-rego-theme/theme.scss)
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Can't find stylesheet to import.
  ╷
1 │ @import 'node_modules/@angular/material/theming';
  │         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ╵
  C:\Users\paul.d\1 - PROJECTS\simple-reg\reg-ui\src\novus-rego-theme\theme.scss 1:9  root stylesheet
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **

Does anyone had the same issues?

Here's my theme.scss file:

@import 'node_modules/@angular/material/theming';
// Plus imports for other components in your app.

// Include the common styles for Angular Material. We include this here so that you only
// have to load a single css file for Angular Material in your app.
// Be sure that you only ever include this mixin once!
@include mat-core();

// Define the palettes for your theme using the Material Design palettes available in palette.scss
// (imported above). For each palette, you can optionally specify a default, lighter, and darker
// hue.
$app-primary: mat-palette($mat-light-blue, 400);
$app-accent: mat-palette($mat-light-blue, A200, A100, A400);

// The warn palette is optional (defaults to red).
$app-warn: mat-palette($mat-red);

// Create the theme object (a Sass map containing all of the palettes).
$app-theme: mat-light-theme($app-primary, $app-accent, $app-warn);

// Include theme styles for core and each component used in your app.
// Alternatively, you can import and @include the theme mixins for each component
// that you are using.
@include angular-material-theme($app-theme);

Upvotes: 0

Views: 562

Answers (1)

N.F.
N.F.

Reputation: 4202

Modify @import 'node_modules/@angular/material/theming'; as below.

@import '~@angular/material/theming';

Upvotes: 2

Related Questions