我的文件css中有这个.component.scss
.bg {
background: url("../../../../assets/images/file.svg") center center no-repeat;
}
Run Code Online (Sandbox Code Playgroud)
并且该路径中只有一个 svg 文件,因此每当我更改该 svg (即fill属性)中的任何内容时,我都会收到此错误
Error: Conflict: Multiple assets emit different content to the same filename file.svg
Run Code Online (Sandbox Code Playgroud)
没有一个问题符合我的情况。
再次运行时ng serve一切正常,但是为什么会出现这种情况呢?
使用此命令安装FlexLayout后
npm i -s @angular/flex-layout @angular/cdk
Run Code Online (Sandbox Code Playgroud)
显然Angular CDK也安装了,我收到以下警告
The Angular Material version (12.1.4) does not match the Angular CDK version (12.2.1).
Please ensure the versions of these two packages exactly match.
Run Code Online (Sandbox Code Playgroud)
我使用ng update命令来更新软件包,也尝试过ng add @angular/material,但我仍然使用相同的版本。
我该如何解决这个问题?
解决方案
命令ng add @angular/material和ng add @angular/material@latest工作正常,我检查了package.json文件并注意到我有
"dependencies": {
...
"@angular/material": "^12.2.1"
...
}
Run Code Online (Sandbox Code Playgroud)
它只是需要ng serve再次。
还有一件事,更新似乎并Angular Material没有真正覆盖styles.scss文件,但实际上再次将相同的代码添加到文件中,所以我也必须删除它才能摆脱 scss 错误。