アプリケーションをangular 5から6に移行した後、ng serveを実行すると、次のエラーポップアップが表示されます。
スキーマの検証が次のエラーで失敗しました:データパス ""に追加のプロパティ(プロジェクト)を含めることはできません。エラー:スキーマの検証が次のエラーで失敗しました:データパス ""に追加のプロパティ(プロジェクト)を含めることはできません。 MergeMapSubscriber._registry.compile.pipe.operators_1.concatMap.validatorResult [プロジェクトとして](.../TemplateApp/me-cmf-web-template-angular/node_modules/@ angular-devkit/core/src/workspace/workspace。 js:210:42)MergeMapSubscriber._tryNext(/.../me-cmf-web-template-angular/node_modules/@angular-devkit/core/node_modules/rxjs/internal/operators/mergeMap.js:65:27 )MergeMapSubscriber.SubscriberのMergeMapSubscriber._next(.../me-cmf-web-template-angular/node_modules/@angular-devkit/core/node_modules/rxjs/internal/operators/mergeMap.js:55:18)で次(/home/training/Attinad_Projects/TemplateApp/me-cmf-web-template-angular/node_modules/@angular-devkit/core/node_modules/rxjs/internal/Subscriber.js:64:18)at MergeMapSubscriber.notifyNext(。 ../TemplateApp/me-cmf-web-template-angular/node_modules/@angular-devkit/core/node_modules/rxjs/internal/operators/mergeMap.js:84:26)at InnerSubscriber._next(.../me -cmf-web-template-angular/node_modules/@ angular-devkit/core/node_modules/rxjs/internal/Inne rSubscriber.js:25:21)InnerSubscriber.Subscriber.next(/.../me-cmf-web-template-angular/node_modules/@angular-devkit/core/node_modules/rxjs/internal/Subscriber.js:64 :18)MapSubscriberのMapSubscriber._next(.../me-cmf-web-template-angular/node_modules/@angular-devkit/core/node_modules/rxjs/internal/operators/map.js:52:26)at MapSubscriber。 Subscriber.next(/.../me-cmf-web-template-angular/node_modules/@angular-devkit/core/node_modules/rxjs/internal/Subscriber.js:64:18)at SwitchMapSubscriber.notifyNext(... /me-cmf-web-template-angular/node_modules/@angular-devkit/core/node_modules/rxjs/internal/operators/switchMap.js:77:26)
エラーは.angular-cli.jsonから名前を変更した.angular.jsonファイルにあると思います。
私の.angular.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ファイルを再構成する必要がありますか?.
どんな助けでも素晴らしいでしょう。
問題を修正したので、ここに投稿するといいと思いました。
ファイル名を.angular.jsonからangular.jsonに変更し、その中の質問の一部のプロパティを置き換えました。
{
"$schema": "./node_modules/@angular-devkit/core/src/workspace/workspace-schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"template-appv6": {
"root": "",
"projectType": "application",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/browser",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.app.json",
"polyfills": "src/polyfills.ts",
"assets": [
{
"glob": "**/*",
"input": "src/assets",
"output": "/assets"
},
{
"glob": "favicon.ico",
"input": "src",
"output": "/"
}
],
"styles": [
"src/styles.scss"
],
"scripts": []
},
"configurations": {
"production": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "template-appv6:build"
},
"configurations": {
"production": {
"browserTarget": "template-appv6:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "template-appv6:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"karmaConfig": "./karma.conf.js",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"scripts": [],
"styles": [
"src/styles.css"
],
"assets": [
{
"glob": "**/*",
"input": "src/assets",
"output": "/assets"
},
{
"glob": "favicon.ico",
"input": "src",
"output": "/"
}
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"server": {
"builder": "@angular-devkit/build-angular:server",
"options": {
"outputPath": "dist/server",
"main": "src/main.server.ts",
"tsConfig": "src/tsconfig.server.json"
}
}
}
},
"template-appv6-e2e": {
"root": "",
"projectType": "application",
"cli": {},
"schematics": {},
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"devServerTarget": "template-appv6:serve"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"e2e/tsconfig.e2e.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"cli": {},
"schematics": {
"@schematics/angular:component": {
"prefix": "app",
"styleext": "css"
},
"@schematics/angular:directive": {
"prefix": "app"
}
}
}
Angular.jsonファイルをangular公式ドキュメントのプロパティに置き換えて、ファイルを変更しました。
angular.jsonの形式はAngular6のとおりである必要があります...以下のangular.jsonを確認するか、Angular6で新しいプロジェクトを作成してから、「プロジェクト」ヘッドの形式を確認してください
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"homePage6": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {
"@schematics/angular:component": {
"styleext": "scss"
}
},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/homePage6",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets",
"src/manifest.json"
],
"styles": [
"src/styles.scss"
],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"serviceWorker": true
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "homePage6:build"
},
"configurations": {
"production": {
"browserTarget": "homePage6:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "homePage6:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [
"styles.scss"
],
"scripts": [],
"assets": [
"src/favicon.ico",
"src/assets",
"src/manifest.json"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"homePage6-e2e": {
"root": "e2e/",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "homePage6:serve"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "homePage6"
}
私は同様の(同一ではないがangular.jsonでも)問題に遭遇しました:
スキーマの検証が次のエラーで失敗しました:データパス "['server']"に追加のプロパティ(スクリプト)を含めることはできません。エラー:スキーマの検証が次のエラーで失敗しました:データパス "['server']"に追加のプロパティ(スクリプト)を含めることはできません。 MergeMapSubscriber._tryNextでMergeMapSubscriber._tryNextに[プロジェクトとして](D:\ Angular7\uHome\node_modules @ angular-devkit\core\src\workspace\workspace.js:215:42)としてMergeMapSubscriber._tryNext (D:\ Angular7\uHome\node_modules\rxjs\internal\operators\mergeMap.js:69:27)at MergeMapSubscriber._next(D:\ Angular7\uHome\node_modules\rxjs\internal\operators\mergeMap.js:59: 18)MergeMapSubscriber.Subscriber.next(D:\ Angular7\uHome\node_modules\rxjs\internal\Subscriber.js:67:18)at MergeMapSubscriber.notifyNext(D:\ Angular7\uHome\node_modules\rxjs\internal\operators\mergeMap.js:92:26)InnerSubscriber._next(D:\ Angular7\uHome\node_modules\rxjs\internal\InnerSubscriber.js:28:21)at InnerSubscriber.Subscriber.next(D:\ Angular7\uHome\node_modules\rxjs\internal\Subscriber.js:67:18)にMapSubscriber._next(D:\ Angular7\uHome\node_modules\rxjs\internal\operators\map.js:55:26)にMapSubscriber.Subscriber.next(D:\ Angular7\uHome\node_modules\rxjs\internal\Subscriber.js:67:18)にSwitchMapSubscriber.notifyNext(D:\ Angular7\uHome\node_modules\rxjs\internal\operators\switchMap.js:86:26)
プロパティスクリプトを自分のangular.jsonから削除する必要がありました...この情報を共有して、将来の誰かを助けます。
RxJS
の非互換性によるものだと思います。これを修正するには、rxjs-compat
をインストールする必要があります。
npm install rxjs-compat
また、ファイルの名前はangular.json
ではなく.angular.json
です。