当前位置: 首页 > 知识库问答 >
问题:

错误:架构验证失败,出现以下错误:数据路径“”不应具有其他属性(项目)

赵涵亮
2023-03-14

将应用程序从角5迁移到角6后,在运行ng service时会弹出以下错误。

架构验证失败,出现以下错误:数据路径“”不应具有其他属性(项目)。错误:架构验证失败,出现以下错误:数据路径“”不应具有其他属性(项目)。在MergeMapSubscriber_注册表。编写管operators\u 1。Concat地图。validatorResult[作为项目](…/TemplateApp/me cmf web template angular/node\u modules/angular devkit/core/src/workspace/workspace.js:210:42)位于MergeMapSubscriber_MergeMapSubscriber上的tryNext(/…/me cmf web模板angular/node\u modules/@angular devkit/core/node\u modules/rxjs/internal/operators/mergeMap.js:65:27)_接下来(…/me cmf web模板angular/node\u modules/@angular devkit/core/node\u modules/rxjs/internal/operators/mergeMap.js:55:18)在MergeMapSubscriber。订阅人接下来(/home/training/Attinad\u Projects/TemplateApp/me cmf web template angular/node\u modules/angular devkit/core/node\u modules/rxjs/internal/Subscriber.js:64:18)在MergeMapSubscriber。InnerSubscriber上的notifyNext(…/TemplateApp/me cmf web template angular/node\u modules/@angular devkit/core/node\u modules/rxjs/internal/operators/mergeMap.js:84:26)_下一步(…/me cmf web模板angular/node\u modules/@angular devkit/core/node\u modules/rxjs/internal/InnerSubscriber.js:25:21)在InnerSubscriber。订阅人下一步(/…/me cmf web模板angular/node\u modules/@angular devkit/core/node\u modules/rxjs/internal/Subscriber.js:64:18)在MapSubscriber_接下来(…/me cmf web模板angular/node\u modules/@angular devkit/core/node\u modules/rxjs/internal/operators/map.js:52:26)在MapSubscriber。订阅人接下来(/…/me cmf web模板angular/node\u modules/@angular devkit/core/node\u modules/rxjs/internal/Subscriber.js:64:18)在SwitchMapSubscriber。notifyNext(…/me cmf web模板angular/node\u modules/@angular devkit/core/node\u modules/rxjs/internal/operators/switchMap.js:77:26)

我假设错误与.angular.json文件,我重新命名从.angular-cli.json。

我的有棱角的json文件如下:

{
    "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
    "project": {
        "name": "mediaweb"
    },
    "apps": [{
            "root": "src",
            "outDir": "dist/browser",
            "assets": [
                "assets",
                "favicon.ico"
            ],
            "index": "index.html",
            "main": "main.ts",
            "polyfills": "polyfills.ts",
            "test": "test.ts",
            "tsconfig": "tsconfig.app.json",
            "testTsconfig": "tsconfig.spec.json",
            "prefix": "app",
            "styles": [
                "styles.scss",
                "../node_modules/owl.carousel/dist/assets/owl.carousel.css",
                "../node_modules/owl.carousel/dist/assets/owl.theme.default.css",
                "../node_modules/video.js/dist/video-js.css"
            ],
            "scripts": [
                "../node_modules/jquery/dist/jquery.js",
                "../node_modules/owl.carousel/dist/owl.carousel.js",
                "../node_modules/video.js/dist/ie8/videojs-ie8.js",
                "../node_modules/video.js/dist/video.js"
            ],
            "environmentSource": "environments/environment.ts",
            "environments": {
                "dev": "environments/environment.dev.ts",
                "prod": "environments/environment.prod.ts"
            }
        },
        {
            "platform": "server",
            "root": "src",
            "outDir": "dist/server",
            "assets": [
                "assets",
                "favicon.ico"
            ],
            "index": "index.html",
            "main": "main.server.ts",
            "test": "test.ts",
            "tsconfig": "tsconfig.server.json",
            "testTsconfig": "tsconfig.spec.json",
            "prefix": "app",
            "styles": [
                "styles.scss"
            ],
            "scripts": [],
            "environmentSource": "environments/environment.ts",
            "environments": {
                "dev": "environments/environment.dev.ts",
                "prod": "environments/environment.prod.ts"
            }
        }
    ],
    "e2e": {
        "protractor": {
            "config": "./protractor.conf.js"
        }
    },
    "lint": [{
            "project": "src/tsconfig.app.json",
            "exclude": ["**/node_modules/**", "**/UI/**"]
        },
        {
            "project": "src/tsconfig.spec.json",
            "exclude": "**/node_modules/**"
        },
        {
            "project": "e2e/tsconfig.e2e.json",
            "exclude": "**/node_modules/**"
        }
    ],
    "test": {
        "karma": {
            "config": "./karma.conf.js"
        }
    },
    "defaults": {
        "styleExt": "scss",
        "component": {}
    }
}

我应该重新构造json文件吗?如果是,如何?。

任何帮助都会很好。

共有3个答案

上官景铄
2023-03-14

当我遇到版本错误问题时,以下命令适用于我:

首次运行:

npm update

第二次运行:

ng update

第三次运行:(它将更新所有不匹配的包)

ng update --all --force
姜志
2023-03-14

我的应用程序位于angular 7.2.3上

从角度删除“es5BrowserSupport”:true。json。现在npm开始工作。

松建本
2023-03-14

问题通常是由于包中的版本不匹配。json文件。

在Angular 7应用程序中,我已将“@Angular devkit/build Angular”:“^0.800.2”更改为“”@Angular devkit/build Angular”:“~ 0.7.0”

然后,在删除节点模块后,我运行命令npm install。

旁白:小心使用^。如果使用的包发生重大变化,您的工作代码将来可能无法工作。

 类似资料: