这个错误通常是由于Angular项目的配置文件(angular.json)中缺少sourceRoot属性而引起的。要解决这个问题,你可以按照以下步骤进行操作:
"projects": {
"项目名称": {
"architect": {
"build": {
"options": {
"sourceRoot": "src"
}
}
}
}
}
这样做应该可以解决该错误。如果问题仍然存在,请确保你的Angular CLI版本与Angular项目版本匹配,并尝试更新Angular CLI到最新版本。