简体   繁体   English

ng服务上的示意图故障

[英]Schematic failures on ng serve

Recently I started running ng serve again on my project, and suddenly I am getting schematic errors. 最近,我开始在项目中再次运行ng serve,突然间我收到了原理图错误。 It builds fine. 它构建良好。

This is the serve target for my app: 这是我的应用程序的服务目标:

    "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"
        }
      }
    }

It hasn't changed in over a year. 一年多来没有变化。 But now I get: 但是现在我得到:

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

I moved the browserTarget within the customWebpackConfig block, and now I get 我将browserTarget移到了customWebpackConfig块中,现在我得到了

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

Obviously something has changed, but I don't know what. 显然情况已经改变,但是我不知道发生了什么。 I have been updating angular and I am now on version: 我一直在更新角度,现在使用的是版本:

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

I am flying blind since the angular.json was generated. 自从angular.json生成以来,我就瞎了。

Any idea where to look? 知道在哪里看吗?

The angular.json is being validated against @angular\\cli\\lib\\config\\schema.json file and the errors you have are related to this validation. angular.json正在验证对@angular\\cli\\lib\\config\\schema.json文件,你必须与此相关的验证错误。 I'd advise you to check if your angular.json complies with the schema. 我建议您检查一下angular.json是否符合架构。 Also, the ng update command helps automatically migrate the code ( angular.json included) so you could give it a try. 另外, ng update命令有助于自动迁移代码(包括angular.json ),因此您可以尝试一下。

Found it! 找到了!

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

should have been 本来应该

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM