小编Bar*_*ear的帖子

错误:.css 中的加载器未返回 Angular 12.1.1 中的字符串

我创建了一个新项目,但每当我编译时都会收到以下 2 条错误消息:

错误:找不到模块:错误:无法解析“C:\Users\Avishek”中的“C:/Users/Avishek/Documents/practice/frontend/src/app/pages/admin/authentication/authentication.component.css” \文档\练习\前端'

错误:加载程序“C:/Users/Avishek/Documents/practice/frontend/src/app/pages/admin/authentication/authentication.component.css”未返回字符串。

我从未遇到过此类问题,甚至几天前我创建了一个具有相同角度版本的项目仍然没有得到。下面分别是我的tsconfig.json&package.json文件。

tsconfig.json

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "forceConsistentCasingInFileNames": true,
    "strict": false,
    "noImplicitReturns": false,
    "noFallthroughCasesInSwitch": true,
    "sourceMap": true,
    "declaration": false,
    "downlevelIteration": true,
    "experimentalDecorators": true,
    "moduleResolution": "node",
    "importHelpers": true,
    "target": "es2017",
    "module": "es2020",
    "lib": [
      "es2018",
      "dom"
    ],
    "paths": {
      "@directive/*": ["src/app/core/directives/*"],
      "@guard/*": ["src/app/core/guards/*"],
      "@interceptor/*": ["src/app/core/interceptors/*"],
      "@pipe/*": ["src/app/core/pipes/*"],
      "@service/*": ["src/app/core/services/*"],
      "@custom-validator/*": ["src/app/core/validators/*"],
      "@model/*": ["src/app/core/models/*"],
      "@store/*": ["src/app/core/store/*"],
      "@feature/*": ["src/app/features/*"],
      "@page/*": ["src/app/pages/*"],
      "@shared/*": ["src/app/shared/*"]
    }
  },
  "angularCompilerOptions": {
    "enableI18nLegacyMessageIdFormat": …
Run Code Online (Sandbox Code Playgroud)

javascript npm typescript angular-cli angular

17
推荐指数
2
解决办法
4万
查看次数

Angular 13:Angular Material 13 自定义主题抛出错误

我为我的项目定制了主题托盘,它可以与^12.2.13Angular 材质版本配合使用,但不能与^13.2.3. 以下是我的自定义主题 SCSS:

\n

客户垫主题.scss

\n
@import '~@angular/material/theming';\n@include mat-core();\n\n$cust-blue: (primary: #002a5c, contrast: (primary: #ffffff));\n$cust-gold: (accent: #989100, contrast: (accent: #ffffff));\n$primary: mat-palette($cust-blue, primary);\n$accent: mat-palette($cust-gold, accent);\n\n$theme: mat-light-theme($primary, $accent);\n\n@include angular-material-theme($theme);\n
Run Code Online (Sandbox Code Playgroud)\n

角度.json

\n
"styles": [\n  "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",\n  "./node_modules/ngx-toastr/toastr.css",\n  "src/styles.css",\n  "src/assets/css/custom-mat-theme.scss"\n]\n
Run Code Online (Sandbox Code Playgroud)\n

错误

\n
\n

./src/assets/css/custom-mat-theme.scss.webpack[javascript/auto]!=!./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[6]。规则[0].oneOf[0].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[6].rules[0].oneOf[0]。 use[2]!./node_modules/resolve-url-loader/index.js??ruleSet[1].rules[6].rules[1].use[0]!./node_modules/sass-loader/dist/ cjs.js??ruleSet[1].rules[6].rules[1].use[1]!./src/assets/css/custom-mat-theme.scss

\n
    \n
  • 错误:模块构建失败(来自 ./node_modules/sass-loader/dist/cjs.js):SassError:'色调“100”在调色板中不存在。可用色调有:原色、对比度' \xe2\x95\xb7 55 \xe2\x94\x82\nlighter: _get-color-from-palette($base-palette, $lighter), \xe2\x94\x82 \n
    ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\xe2\ x95\xb5
    \nnode_modules@angular\\material\\core\\theming_theming.scss 55:14
    \ndefine-palette()
    \nnode_modules@angular\\material\\core\\theming_theming-deprecated.scss\n16:11 调色板( ) src\\assets\\css\\custom-mat-theme.scss 6:11
    \n根样式表
  • \n
\n
\n

谁能告诉我这有什么问题吗?

\n

css sass angular-material angular angular13

9
推荐指数
1
解决办法
7035
查看次数

安装 posh-git 后图标未显示在 powershell 中

今天我在 PowerShell 中安装了 posh-git,但图标没有显示,而是显示一个内部带有问号的矩形框。以下是我遵循的步骤:

Install-Module oh-my-posh -Scope CurrentUser

然后

Install-Module posh-git -Scope CurrentUser

对于这两个包,我都选择了“Yes To All”选项。

安装软件包后,我打开 Microsoft.PowerShell_profile.ps1文件并添加以下代码片段:

Import-Module oh-my-posh
Import-Module posh-git

Set-PoshPrompt -Theme M365Princess
# M365Princess is the theme name I found from oh-my-posh doc
Run Code Online (Sandbox Code Playgroud)

settings.json之后我在 VS Code 中添加了这个"terminal.integrated.fontFamily": "Fira Code".

仅供参考,我已经安装了该Fira Code Medium Nerd Font Complete Windows Compatible字体。

然后通过VS Code重新启动。颜色显示完美,还有一些图标,但也有一些图标丢失,如下面的屏幕截图中的示例。

豪华 Git

请帮我解决这个问题。

windows powershell posh-git visual-studio-code oh-my-posh

5
推荐指数
1
解决办法
5029
查看次数