ng服务上的示意图故障

时间:2019-08-23 20:50:00

标签: javascript node.js typescript angular-cli

最近我开始在我的项目上再次运行ng serve,突然间我收到了原理图错误。一切正常。

这是我的应用程序的投放目标:

    "serve": {
      "builder": "@angular-builders/custom-webpack:server",
      "options": {
        "customWebpackConfig": {
          "path": "./extra-webpack.config.js",
          "mergeStrategies": { "module.rules": "prepend" },
          "replaceDuplicatePlugins": true
        },
        "browserTarget": "evidentia4:build"
      },
      "configurations": {
        "production": {
          "browserTarget": "evidentia4:build:production"
        }
      }
    }

一年多来没有变化。但是现在我得到了:

Data path "" should NOT have additional properties(browserTarget).

我将browserTarget移到了customWebpackConfig块中,现在我得到了

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

显然情况有所改变,但我不知道是什么。我一直在更新angular,现在使用的是版本:

Angular CLI: 8.3.0
Node: 12.7.0
OS: darwin x64
Angular: 8.2.3
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.801.3
@angular-devkit/build-angular     0.801.3
@angular-devkit/build-optimizer   0.801.3
@angular-devkit/build-webpack     0.801.3
@angular-devkit/core              8.1.3
@angular-devkit/schematics        8.3.0
@angular/cdk                      8.1.3
@angular/cli                      8.3.0
@angular/flex-layout              8.0.0-beta.26
@angular/material                 8.1.3
@ngtools/webpack                  8.1.3
@schematics/angular               8.3.0
@schematics/update                0.803.0
rxjs                              6.5.2
typescript                        3.4.5
webpack                           4.39.2

自从angular.json生成以来,我就瞎了。

有什么想法去哪里找?

2 个答案:

答案 0 :(得分:0)

正在针对angular.json文件验证@angular\cli\lib\config\schema.json,并且您遇到的错误与此验证有关。我建议您检查您的angular.json是否符合该架构。此外,ng update命令有助于自动迁移代码(包括angular.json),因此您可以尝试一下。

答案 1 :(得分:0)

找到了!

"builder": "@angular-builders/custom-webpack:server"

应该是

"builder": "@angular-builders/custom-webpack:dev-server"