angular cli 7.1无法创建新项目,架构验证错误

时间:2018-11-28 09:03:46

标签: angular angular-cli

我正在使用角度cli 6+。今天,我将cli升级到7.1,并尝试创建一个新的应用程序。我运行以下命令创建一个新项目

ng new my-first-project

我收到以下错误。

    Schematic input does not validate against the Schema: {"name":"my-first-project"}
Errors:

  Data path "" should have required property 'version'.

然后我像这样运行命令。

ng new my-first-project --version=1.1

我得到了错误。

 Tree type is not supported.

以下是我的设置。

Angular CLI: 7.1.0
Node: 8.11.3
OS: darwin x64
Angular: 
... 

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.11.0
@angular-devkit/core         7.1.0
@angular-devkit/schematics   7.1.0
@schematics/angular          7.1.0
@schematics/update           0.11.0
rxjs                         6.3.3
typescript                   3.1.6

我在这里想念什么吗?

谢谢

1 个答案:

答案 0 :(得分:0)

从Schemas schema.json看来,

对于ng-new命令-将Schema和名称一起定义为强制性标志,请在Schema-json文件底部的ng-new diagrams文件夹中检出所需部分。 , 可能这就是为什么您收到有关所需版本的错误的原因:

  

node_modules @ schematics \ angular \ ng-new \ schema.json

  "required": [
    "name",
    "version"
  ]

您可以尝试像这样具体指示名称标志:

  

ng new --name = my-first-project --version = 1.1.0

尽管索引0处的名称(零)不需要标志:

"name": {
  "description": "The name of the new workspace and initial project.",
  "type": "string",
  "format": "html-selector",
  "$default": {
    "$source": "argv",
    "index": 0
  },
  "x-prompt": "What name would you like to use for the new workspace and initial project?"
},
相关问题