Angular 项目构建无法获取/错误

Angular project build with Cannot Get / error

我试图在 IntelliJ 中 运行 我的 Angular 并得到这个错误。当我在本地主机上打开浏览器时,它显示 Cannot GET /

我采取的步骤是:

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 - 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/ **

有人遇到同样的问题吗?

这是我的 theme.scss 文件:

@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);

修改@import 'node_modules/@angular/material/theming';如下。

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