0

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:

  • Open up the project
  • npm install -g @angular/cli@latest
  • gradlew clean build
  • ng serve
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);

0

1 Answer 1

2

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

@import '~@angular/material/theming';
Sign up to request clarification or add additional context in comments.

4 Comments

It works! I can open my project on the browser now. Thanks mate. Do you know why I get this oauth error though?
[HPM] POST /oauth/token -> localhost:8090 [HPM] Error occurred while trying to proxy request /oauth/token from localhost:4200 to localhost:8090 (ECONNREFUSED) (nodejs.org/api/erro rs.html#errors_common_system_errors)
Are you now facing this error? This is an another issue. I suggest you to post a new question.
Yes, it's the same project. Just realized I got this error. Will post a new question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.