[英]Angular project build with Cannot Get / error
I tried to run my Angular in IntelliJ and got this error.我试图在 IntelliJ 中运行我的 Angular 并收到此错误。 When I open the browser on localhost it shows
Cannot GET /
当我在 localhost 上打开浏览器时,它显示
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:这是我的
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);
Modify @import 'node_modules/@angular/material/theming';
修改
@import 'node_modules/@angular/material/theming';
as below.如下。
@import '~@angular/material/theming';
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.