当 运行 ng 生成 class customer -type=model 时,收到错误“Unknown Option: 'e'

When running ng generate class customer -type=model, receiving an error "Unknown Option: 'e'

尝试根据 this page

部署简单的 MEAN 堆栈应用程序

我使用的是 Centos 8 OS。我已经在下面详细发布了我的系统环境。

当运行以下命令时:

ng generate class customer –type=model

出现以下错误:

[root@localhost src]# ng generate class customer -type=model
Unknown option: '-e'

我试过在网上搜索,没有发现这个错误,或者我错过了那个地方。 我已经详细发布了环境,如下所示。非常感谢任何帮助。

[root@localhost src]# node -v
v16.13.1
[root@localhost src]# npm -v
8.1.2
[root@localhost src]# ng version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 13.2.2
Node: 16.13.1
Package Manager: npm 8.1.2
OS: linux x64

Angular: 13.2.1
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1302.2
@angular-devkit/build-angular   13.2.2
@angular-devkit/core            13.2.2
@angular-devkit/schematics      13.2.2 (cli-only)
@schematics/angular             13.2.2 (cli-only)
rxjs                            7.5.2
typescript                      4.5.5

您需要在指定选项时使用 -- 而不是 -。因此,使用 type 选项生成 class 的正确方法是:

ng generate class customer --type=model

ng g class customer --type=model

参考: class schematic command