You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Angular Material主题编译失败求助:无法解析预构建主题文件

Fixing Angular Material Theme Import Error

Looks like you’ve hit a common typo issue in your theme import path! Let’s break down the fixes step by step:

1. Correct the Typo in the Theme Filename

The error message points to indogo-pink.css, but the actual prebuilt theme filename is indigo-pink.css (note the correct spelling of "indigo" instead of "indogo"). Update your style.css import line to:

@import "~@angular/material/prebuilt-themes/indigo-pink.css";

2. Verify Angular Material Installation

If the typo fix doesn’t resolve the issue, double-check that Angular Material is properly installed in your project. Run this command in your project root to ensure it’s added:

npm install @angular/material @angular/cdk

3. Confirm the Theme File Exists in node_modules

Navigate to your project’s node_modules/@angular/material/prebuilt-themes directory and make sure indigo-pink.css is present. If it’s missing, reinstalling Angular Material should fix this.

4. Check Angular CLI Version Compatibility

Ensure your Angular CLI version is compatible with the installed Angular Material version. You can check your CLI version with:

ng version

If there’s a mismatch, consider updating your CLI or Material package to matching versions.

After making these changes, restart your development server (ng serve) and the compilation error should be resolved.

内容的提问来源于stack exchange,提问作者Adynh

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 07:39:47