【问题标题】:I cannot go through ng serve我无法通过 ng serve
【发布时间】:2020-07-06 07:03:17
【问题描述】:

每当我输入 ng serve 时,它都会打印:

您的全局 Angular CLI 版本 (10.0.1) 高于本地版本 版本(6.2.9)。使用本地 Angular CLI 版本。

要禁用此警告,请使用ng config -g cli.warnings.versionMismatch false

Schema validation failed with the following errors:
  Data path ".builders['app-shell']" should have required property 'class'.
Error: Schema validation failed with the following errors:
  Data path ".builders['app-shell']" should have required property 'class'.
    at MergeMapSubscriber.project (d:\문현주\Desktop\Coursera Bootstrap\Angular\conFusion\node_modules\@angular-devkit\core\src\workspace\workspace.js:210:42)
    at MergeMapSubscriber._tryNext (d:\문현주\Desktop\Coursera Bootstrap\Angular\conFusion\node_modules\rxjs\internal\operators\mergeMap.js:65:27)
    at MergeMapSubscriber._next (d:\문현주\Desktop\Coursera Bootstrap\Angular\conFusion\node_modules\rxjs\internal\operators\mergeMap.js:55:18)
    at MergeMapSubscriber.Subscriber.next (d:\문현주\Desktop\Coursera Bootstrap\Angular\conFusion\node_modules\rxjs\internal\Subscriber.js:64:18)
    at MergeMapSubscriber.notifyNext (d:\문현주\Desktop\Coursera Bootstrap\Angular\conFusion\node_modules\rxjs\internal\operators\mergeMap.js:84:26)
    at InnerSubscriber._next (d:\문현주\Desktop\Coursera Bootstrap\Angular\conFusion\node_modules\rxjs\internal\InnerSubscriber.js:25:21)
    at InnerSubscriber.Subscriber.next (d:\문현주\Desktop\Coursera Bootstrap\Angular\conFusion\node_modules\rxjs\internal\Subscriber.js:64:18)
    at MapSubscriber._next (d:\문현주\Desktop\Coursera Bootstrap\Angular\conFusion\node_modules\rxjs\internal\operators\map.js:52:26)
    at MapSubscriber.Subscriber.next (d:\문현주\Desktop\Coursera Bootstrap\Angular\conFusion\node_modules\rxjs\internal\Subscriber.js:64:18)
    at SwitchMapSubscriber.notifyNext (d:\문현주\Desktop\Coursera Bootstrap\Angular\conFusion\node_modules\rxjs\internal\operators\switchMap.js:77:26)

有人知道怎么解决吗?

【问题讨论】:

  • 您需要帮助解决这两个问题中的哪一个?版本不匹配,还是所需的属性问题?

标签: angular


【解决方案1】:

您基本上有三个选项来修复版本不匹配:

  • 使用 npm i -g @angular/cli@6.9.2 安装与全局 Angular CLI 相同的 Angular 版本(仅在这是您唯一的 Angular 项目时推荐)
  • 将项目更新为全局 cli 版本
  • 按照指示抑制警告。如果ng config -g cli.warnings.versionMismatch false 不适合您,您可以通过将设置添加到项目的angular.json 末尾来手动关闭警告:
     "defaultProject": "my-awesome-project",
+    "cli": {
+      "warnings": {
+        "versionMismatch": false
+      }
+    }
   }

【讨论】:

    猜你喜欢
    • 2020-11-13
    • 1970-01-01
    • 1970-01-01
    • 2022-01-22
    • 2022-01-02
    • 2018-02-07
    • 1970-01-01
    • 1970-01-01
    • 2022-08-11
    相关资源
    最近更新 更多