在集合“@schematics/angular”中找不到原理图 "shared/services/lessons"

Schematic "shared/services/lessons" not found in collection "@schematics/angular"

当我尝试使用此命令创建服务时 ng g shared/services/lessons -d, 它总是抛出这个异常:Schematic "shared/services/lessons" not found in collection "@schematics/angular".

我已经重新安装了 node_modules,结果相同。

ng --version 给我看这个:

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.901.7
@angular-devkit/build-angular     0.901.7
@angular-devkit/build-optimizer   0.901.7
@angular-devkit/build-webpack     0.901.7
@angular-devkit/core              9.1.7
@angular-devkit/schematics        9.1.7
@angular/cdk                      9.2.4
@angular/cli                      9.1.7
@angular/material                 9.2.4
@ngtools/webpack                  9.1.7
@schematics/angular               11.2.2
@schematics/update                0.901.7
rxjs                              6.5.5
typescript                        3.8.3
webpack                           4.42.0

问题是您缺少第三个参数,即要提供的原理图。

ng g <schematic> shared/services/lessons -d

如需服务,请使用示意图services

您可以找到所有原理图及其选项here