오류: 스키마 유효성 검사에 실패하고 다음 오류가 발생했습니다. 데이터 경로 ""에 추가 속성이 없어야 합니다(프로젝트).
각 5에서 6으로 응용 프로그램을 마이그레이션하면 실행 중인 ng serve에서 다음 오류가 나타납니다.
스키마 유효성 검사에 실패하고 다음 오류가 발생했습니다. 데이터 경로 ""에 추가 속성이 없어야 합니다(프로젝트).오류: 스키마 유효성 검사에 실패하고 다음 오류가 발생했습니다. 데이터 경로 ""에 추가 속성이 없어야 합니다(프로젝트).MergeMapSubscriber에서._registry.compile.pipe.operator_1.concatMap.validatorResult [as project] (...MergeMapSubscriber에서 /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/내부/operators/mergeMap.js:65:27)를 사용합니다.MergeMapSubscriber에서 _next(.../me-cmf-web-template-angular/node_modules/@angular-devkit/core/node_modules/rxjs/내부/연산자/mergeMap.js:55:18).MergeMapSubscriber.notify에서 Subscriber.next(/home/training/Attinad_Projects/TemplateApp/me-cmf-web-template-angular/node_modules/@angular-devkit/core/node_modules/rxjs/internal/Subscriber.js:64:18).다음(...)/TemplateApp/me-cmf-web-template-angular/node_modules/@angular-devkit/core/node_modules/rxjs/내부/연산자/mergeMap.js:84:26).InnerSubscriber에서 _next (.../me-cmf-web-template-angular/node_modules/@angular-devkit/core/node_modules/rxjs/internal/InnerSubscriber.js:25:21).MapSubscriber에서 Subscriber.next(/.../me-cmf-web-template-angular/node_modules/@angular-devkit/core/node_modules/rxjs/internal/Subscriber.js:64:18).MapSubscriber에서 _next(.../me-cmf-web-template-angular/node_modules/@angular-devkit/core/node_modules/rxjs/내부/연산자/map.js:52:26).SwitchMapSubscriber.notify에서 Subscriber.next(/.../me-cmf-web-template-angular/node_modules/@angular-devkit/core/node_modules/rxjs/internal/Subscriber.js:64:18)다음(.../me-cmf-web-template-angular/node_modules/@angular-devkit/core/node_modules/rxjs/내부/연산자/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 파일을 어떻게 재구성해야 합니까?
어떤 도움이라도 주시면 감사하겠습니다.
으로 귀하의 으로 로 합니다 는 합니다 의 버전 불일치로 합니다.package.json
파일.파일.
7는 Angular 7 에서 가 가 에서 "@angular-devkit/build-angular": "^0.800.2"
"@angular-devkit/build-angular": "~0.7.0"
.
그 다음 명령어를 실행했습니다.npm install
를 한 후node_modules
.
: 사용 : ^
◦ 이 있을 , 하지 않을 수 .사용한 패키지에 중대한 변경이 있을 경우 향후 작업 코드가 작동하지 않을 수 있습니다.
동일한 package-lock.json 파일을 사용하는 것도 마법이 될 것입니다.
제 앱은 angular 7.2.3 입니다.
"es5BrowserSupport" 제거: true from angular.json. and npm start now work.
버전 오류 문제가 발생할 때 다음 명령이 작동했습니다.
첫 번째 실행:
npm update
두 번째 런:
ng update
세 번째 실행: (모든 일치하지 않는 패키지를 업데이트합니다.)
npm update --all --force
그냥 angular.json 파일로 가서 제거하면 됩니다.
"extractCss": true
에서
생산부
첫번째:
npm uninstall @angular-devkit/build-angular
다음:
npm install @angular-devkit/build-angular@0.12.4
9에서 10으로 각도 업그레이드는 매우 쉽습니다(추가적인 모든 세부 정보는 여기에 있습니다: https://update.angular.io/ ?v=9.0-10.0):
패키지 파일이 버전 제어 상태에 있고 모든 변경 사항이 커밋되었는지 확인합니다.패키지 파일을 덮어씁니다.새로운 실험 지점에서 시도해 보는 게 좋을 겁니다.
npm install -g npm-check-updates
ncu -u
ng update --all --force
스키마에서는 더 키 에서는 를 할 을 사용할 수 .es5BrowserSupport
; 당신의 다음 행을 제거합니다.angular.json
:
"es5BrowserSupport": true
그런 다음 애플리케이션을 새로 시작하기만 하면 됩니다.
npm start
제가 이 문제를 고쳤기 때문에 여기에 올리는 것이 좋을 것 같습니다.
파일 이름을 .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 Update Guide에는 버전 업데이트 방법에 대한 단계별 가이드가 나와 있습니다.
변경 package.json
사람 삭제:
"@angular-devkit/build-angular": "^0.13.5",
대상:
"@angular-devkit/build-angular": "^0.12.1",
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')에 추가 속성(스크립트)이 없어야 합니다.오류: 스키마 유효성 검사에 실패하고 다음 오류가 발생했습니다. 데이터 경로 "['server']"에 추가 속성(스크립트)이 없어야 합니다.MergeMapSubscriber에서.MergeMapSubscriber에서 _registry.compile.pipe.operators_1.concatMap.validatorResult [프로젝트로서] (D:\Angular7\uHome\node_modules@angular-devkit\core\src\workspace.js:215:42)._tryNext (D:MergeMapSubscriber에서 Angular7\uHome\node_modules\rxjs\내부\operators\mergeMap.js:69:27)._next (D:MergeMapSubscriber에서 \Angular7\uHome\node_modules\rxjs\내부\operators\mergeMap.js:59:18).subscriber.next (D:\angular7\uHome\node_modules\rxjs\내부\MergeMapSubscriber.notify에서 Subscriber.js:67:18)다음(D:InnerSubscriber에서 \Angular7\uHome\node_modules\rxjs\내부\operators\mergeMap.js:92:26)._next (D:\angular7\uHome\node_modules\rxjs\내부\InnerSubscriber.js:28:21)에서 InnerSubscriber.subscriber.next (D:\angular7\uHome\node_modules\rxjs\내부\MapSubscriber에서 Subscriber.js:67:18)._next (D:MapSubscriber에서 \Angular7\uHome\node_modules\rxjs\내부\operators\map.js:55:26).subscriber.next (D:\angular7\uHome\node_modules\rxjs\내부\SwitchMapSubscriber.notify에서 Subscriber.js:67:18)다음(D:\angular7\uHome\node_modules\rxjs\내부\operators\switchMap.js:86:26)
내 angular.json에서 부동산 스크립트를 제거해야 했습니다.미래의 누군가를 돕기 위해 이 정보를 공유하는 것.
업그레이드 시Angular
8
10
저도 아주 비슷한 오류를 당했습니다. 즉,Schema validation failed with the following errors: Data path "" should NOT have additional properties(serverTarget).
.
은 Δ Δ Δ Δ Δ Δ Δ Δ Δ Δ Δ Δ Δ 모두 제거했습니다."serverTarget"
의 언급의급wsm"serve"
. 아래 내용이 틀렸습니다.
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "my_app:build"
"serverTarget": "my_app:server"
},
"configurations": {
"production": {
"browserTarget": "my_app:build:production",
"serverTarget": "my_app:server:production"
}
}
},
다음 내용이 정확하고 성공적으로 컴파일되었습니다.
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "my_app:build"
},
"configurations": {
"production": {
"browserTarget": "my_app:build:production"
}
}
},
함께 근무하는 분들께는 보너스Angular Universal
하려면 .SSR에서 하십시오.localhost
, 그렇다면 당신은 정말로 필요합니다.serverTarget
는 . 를 을 해야 해야 를 을 angular.json
과 과 등
"serve-ssr": {
"builder": "@nguniversal/builders:ssr-dev-server",
"options": {
"browserTarget": "my_app:build",
"serverTarget": "my_app:server"
},
"configurations": {
"production": {
"browserTarget": "my_app:build:production",
"serverTarget": "my_app:server:production"
}
}
},
그리고나서ng run my_app:serve-ssr
.
를 업그레이드할 때 이 오류가 했습니다.Angular
10
안으로8
뭔가 개선하고 싶었단 말입니다그럼 내가 망쳤어요.serverTarget
생각을 것, 바라건대 .Angular Universal
중 npm
그리고.angular
고정 광산:
한다고 할 를 사용한다고 합니다.npm
npm update
실행:
ng update
NB: 개별 종속성을 업데이트하라는 메시지가 표시될 수 있습니다.제 경우에는 다음과 같이 실행하라는 메시지를 받았습니다.
ng update @angular/cli
그리고.ng update @angular/core
.
이 오류는 angular.json 구성에서 지원되지 않는 일부 속성을 추가할 때도 나타납니다.
Angular 은 Angular 은 에 되어야 하는 되어야 합니다.projects
가 이지만, 이우s'에),다나이'다에r우나이s(rhproject
상위 레벨 속성이 여기에 나열되어 있습니다.
제가 봤을 때는.RxJS
위화감이 없습니다설치해야 합니다.rxjs-compat
이걸 고치기 위해서.
npm install rxjs-compat
은 입니다.angular.json
아닌.angular.json
에 가다package.json
그리고 @ymmetry-devkit/build-guard의 버전을 다음과 같이 변경합니다.
@angular-devkit/build-angular": "^0.12.4"
angular.json 파일에서 다음 두 줄을 제거합니다.
"vendorSourceMap":"true",
"evalSourceMap":"true".
하기 하기 하기 es5BrowserSupport: true
angular.json
문제를 고쳤습니다.
내가 업데이트를 하고 있을 때부터.Angular7
Angular11
, https://update.angular.io/ 업그레이드 가이드에서 포인트를 건너뛰었습니다.
도 es5BrowserSupport flags in your angular.json
그리고 당신의 것을 설정합니다.target to es2015 in your tsconfig.json
합니다. Angular는 이제 브라우저 목록을 사용하여 ES5 빌드가 필요한지 여부를 확인합니다.ng 업데이트를 하면 자동으로 마이그레이션됩니다.
방금 node_module 폴더를 삭제하고 실행했습니다.
NPM 설치
저한테는 잘 통했어요
이것은 Angular 9 솔루션입니다.
위에 써있는 것들을 다 시도해봐도 여전히 작동이 되지 않았습니다.그때까지 시스템을 재부팅했습니다.이것을 당신의 마지막 수단에 추가하세요.
- 시스템 재부팅
하고 node_design을 하면 .npm i
버전으로 할 때 잘 경우가 .서른로할때부가잘지는가한다s가는지잘가nseum부lent'서한
버전 번호는 다른 각도 패키지와 유사해야 하며 "float.json"에서 "float/cli" 버전을 확인하십시오.
"devDependencies": {
"@angular-devkit/build-angular": "~0.803.29",
"@angular/cli": "~13.2.2", (this is the wrong one)
"@angular/compiler-cli": "~8.2.14",
프로젝트에서 ng-packagr(.../another-lib) 범위를 벗어난 다른 라이브러리로 파일 중 하나에서 상대적인 가져오기를 사용했습니다.모듈 가져오기(@scope/another-lib)로 변경 후 작동하였습니다.
방금 이 문제에 직면했는데, 제가 생각하기에 angular.json 섹션에 basehref를 추가해서 제거하고 효과가 있었기 때문입니다.& 루트 베이스href를 각도 앱에 추가하는 데 문제가 있는 사람은 아래와 같이 해야 할 수 있습니다:-
- app.module.ts에서 이 <'@angular/common'에서 {APP_BASE_HREF} 가져오기>
- & 그런 다음 모듈 어레이에서 이를 개체로 목록에 추가합니다 <{제공: APP_BASE_HREF, useValue: '/your-root-url/'}>
Angular 16 beta 버전의 경우 tsConfig를 에 추가했습니다.architect > build > options
다음과 같이:"tsConfig": "src/tsconfig.app.json"
대부분의 경우 CLI에서 이런 내용을 추가했지만 저의 경우에는 없었습니다.
언급URL : https://stackoverflow.com/questions/52398449/error-schema-validation-failed-with-the-following-errors-data-path-should-n
'programing' 카테고리의 다른 글
사용자를 변경하려면 어떻게 해야 합니까?(cmd, mariadb) (0) | 2023.09.09 |
---|---|
도커 로그인: '스터브가 잘못된 데이터를 수신했습니다' 자격 증명을 저장하는 중 오류가 발생했습니다. (0) | 2023.09.09 |
부모 레코드별 최신 자식 레코드(조건 포함) 찾기 (0) | 2023.09.09 |
HTML에서 PDF를 생성하기 위해 wkhtmltopdf 호출 (0) | 2023.09.09 |
jQuery: 버튼을 제외한 첫번째 보이는 입력/선택/텍스트 영역을 찾는 방법? (0) | 2023.09.09 |